The purpose of this section is to help you get started with developing widgets. This section provides you with an overview of the steps included in the development process. It also provides general information on the files that constitute a widget package. Widgets are lightweight Web applications developed using the same well-known standards-based Web technologies – AJAX, CSS, HTML and JavaScript – used to create Web pages. Developers can use it as a reference and testers can use it to test the relevant functionality. Widget is intended for S60 SDK. Developers should be able to develop professional applications.
To develop a widget for a mobile device, you need:
Desktop computer that can be used to develop Web content
Text editor to create HTML, CSS and JavaScript files
A text editor such as Notepad is sufficient for developing widgets. However, you can also use a more advanced development tool. Web developers can use the same tools that they have used for creating Web content.
Graphics program if you need to create images for your widget.
ZIP utility such as WinZip to create the widget installation package.
Desktop Web browser, such as Mozilla Firefox or Internet Explorer.
Mobile device with the S60 3rd edition SDK or later.
The widget development process includes several steps. It is important that you go through all these steps. To develop a widget for S60 5th Edition SDK or later mobile devices:
Define the purpose and scope of your service and design a widget.
Before starting the actual widget development, define the requirements, scope, and functionality that you wish to implement in your widget. The analysis and design phase is very crucial, especially to efficient functionality and smooth user experience. Remember that a widget is typically designed for a single purpose. Analyze how the widget can best serve its users
Create the widget functionality and all the required component files.
Widgets are based on standard Web technologies, so you can develop your widget using the same tools that you would use to create Web content. For instructions on how to implement the widget functionality, see "Developing widgets" in WDL. For more information on the required widget component files, see "Widget component files". For code examples, see the Web Runtime API Reference and How to pages available at Forum Nokia.
Create the widget installation package:
Installing and running the widget
Use the file - Open option to open
the widget under C:\S60\devices\ S60_5th_SDK_v1.0\S60WidgetExamples\JavaScriptConsole.wgz
.
The SDK recognizes and installs the widget. Run the widget from the installations folder.
Select the "open browser" option. If the widget is running on a device, Browser is opened from the widget. Go to Settings -> General -> Java/ECMA Script Errors Notification. Set any one option. Exit the browser.
Test the widget
If the widget is running on an emulator, exit the widget; set the Java/ECMA script errors options in the browser. Then restart the widget.
Widget returns to the foreground in case of a device. In case of running on a emulator, start the widget. Select the "Run Script" option. Click on the submit button to run the script.
No notification |
No notifications for Java/ECMA script errors. |
Create log file |
It will create log file to the C:\Data folder of SDK |
Show pop-up notes |
It will show pop-up notes on the emulator screen |
Log and pop-up notes |
It will show pop-up notes and create logs to C:\Data folder of the SDK |
If the selected option is "Log to Console", output will be as shown,
If the selected option is "log to file", the error will be logged in the file C:\S60\devices\ S60_5th_SDK_v1.0\epoc32\winscw\c\Data\jslog_widget.log
There are several ways in which you can offer your widget to end users for deployment on S60 mobile devices. The most suitable method depends on your business plans. Moreover, if you decide to distribute the widget on your Web site, mobile device users can either download the widget directly to their mobile device or first download it to a PC and from there to their mobile device.
The following table lists the methods that are supported for deploying widgets on a mobile device:
Widget deployment methods | ||
---|---|---|
Deployment method |
Deployment location on the device |
Installationmethod |
Transfer via Bluetooth, email or other communication method |
Inbox folder of the Messaging application |
Using the Messaging application. |
Transfer using a USB cable |
Phone memory |
Using the File Manager (File mgr) application. |
Transfer via a memory card |
Memory card |
Using the File Manager (File mgr) application. |
Transfer using the Web Browser for S60 |
If the MIME type is specified correctly for the widget package, the installation will be completed automatically. See the instructions below. |
The Web Runtime environment includes a recognizer component that is able to detect when the user activates a widget for installation. It recognizes the file as a widget based on the file extension and MIME type. Therefore, if you decide to provide widgets on your Web site for download, you need to do the following to enable successful download and installation on mobile devices:
Provide a URL to the widget on the Web site.
Specify the MIME type of the widget installation package in the HTTP response header. The MIME type must be application/x-nokia-widget.
The following is an example of how to define the widget MIME type for an Apache server configuration file:
AddType x-nokia-widget
.wgz
Widgets do not need to be signed (for example, Symbian Signed) before deploying them on a mobile device.
Widgets running on S60 mobile devices access the network through the Web Browser for S60. Widgets implement a sandbox security model that is similar to but separate from the browser, and they only have limited access to the S60 platform services. In this respect, widgets are as safe as running Web pages in the browser. As a result, widgets do not need to be signed (for example, Symbian Signed). Widgets are always considered untrusted by the device platform.