| This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. The article is believed to be still valid for the original topic scope. |
Contents |
Before a widget can be published at www.widsets.com, it must be tested on the developer-server with both an emulator and real mobile devices.
The following guidelines should be taken into account when writing widgets:
In the maximized mode, if you display a loading prompt while loading, always include a Cancel option. Due to connectivity problems, it might be that the call never responds, and default timeout is 4 minutes.
Note. Due to the communication architecture, it is not possible to cancel a service-call that has been already been sent, but you should still act like it has been canceled and skip the success/failure calls when they eventually come.
Before doing any automatic calls (scheduled) you should check if client is online isOnline().
In case of user-initiated calls, it is OK to make the call even when you're offline. System will automatically call failure-callback with error that you should be online to do the call.
If you need to make multiple calls to the server, place the next call after receiving response to the last one. This helps the load at server-side wheen there are no multiple requests being served at the same time.
Try to minimize memory usage, for example by limiting the use of global objects.
Remember to clean up Store from old data that is not used anymore. A single widget should not store more than 500Kb to Store (RMS).
Always remember to stop your scheduled timers. This can be done in closeWidget() callback which is called when the widget exists from maximized mode.
If you schedule your timer in startWidget(), adjust the first hit to 10-30s so that WidSets has time to start up properly.
When doing service-calls on timer, make sure that the previous call has finished before placing new one and check that isOnline() before calling too.
'Note. If you schedule a new timer reference over existing one, it does not cancel the existing timer.
Timer myTimer = schedule(10*1000, 60*1000); //first timer ... myTimer = schedule(10*1000, 5*60*1000); //second timer
WRONG, reference to first timer is lost but the timer will remain active until WidSets client is closed. You always need to cancel() existing timers.
Generally it is good to be as lazy as possible, that is, to load stuff late - only when they are needed.