Skip to main content

PushRegistry Alarm. Why OTA?

3 replies [Last post]
Joined: 2008-12-01


I have succeeded in developing an application with a midlet (AlarmMidlet) that launches a second midlet (AutoMidlet) using the following line:
l = PushRegistry.registerAlarm( "AutoMidlet", now.getTime() + 60000 );

However, I can only launch the application successfully using the Sun Java WTK's OTA feature.

Can someone offer an alternative mode of installation to the device for further testing. I don't want to set up a server just to install and test this application. If it must be completed via OTA can an OTA install be done via bluetooth? If so, could you point me in the right direction?

Also, how/why does PushRegistry.registerAlarm() use the network? It is obvious how PushRegistry.registerConnection() operates -it requires a network connection, but why does registerAlarm() require a network connection?

Here is the code I have:

public class AlarmMIDlet extends MIDlet {
public AlarmMIDlet() {
System.out.println( "AlarmMIDlet: constructor" );
public void startApp() {
System.out.println( "AlarmMIDlet: startApp" );
try {
Date now = new Date();
long previous;
previous = PushRegistry.registerAlarm( "AutoMidlet", now.getTime() + 60000 );
System.out.println( "AlarmMIDlet: time of previous alarm: " + previous );
} catch ( java.lang.ClassNotFoundException cnf ) {
System.out.println( "AlarmMIDlet: Class not Found" );
} catch ( connnf ) {
System.out.println( "AlarmMIDlet: Connection Not Found" );
System.out.println( "AlarmMIDlet: startApp: return" );
public void pauseApp() {
System.out.println( "AlarmMIDlet: pauseApp" );
public void destroyApp( boolean unconditional ) {
System.out.println( "AlarmMIDlet: destroyApp" );

AutoMidlet simply displays a form when called.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-12-01

I have successfully run the app on device without OTA installation. I just did not realize that after launching AlarmMidlet I had to close the application and navigate back to the main (idle) screen. The phone is a Nokia S40 series. Hopefully I will be able to find some specs on how the Nokia S40 (and other phones) handle the push registry alarm.

The push registry alarm feature does not seem particularly useful seeing as the phone must remain idle in order to receive the notification. But perhaps, as before, I am mistaken again.

Joined: 2003-06-15

The phone should not have to be idle to have your midlet woken up by the alarm. However there are certain activities and operators that can disable this, or at least not allow your app to display correctly.

I've been using SMS pushregistry wake up for some time now, and it will activate a phone when it is in most states. However this may not be the most user friendly thing to do, and something you should consider when building your workflow.

As an example, if the user is on the phone and holding it up to their face, it may be a shock to them and cause them to freak out if you were to cause the phone to vibrate. Or if they are on a call with something using a touch screen and pop up a screen to get user input. The users face might accidentally touch the screen and give an incorrect response.

Nokia's forums should have some documentation and examples of alarm pushregistry code for the series 40 devices.

Also for installing your app on a device, I've used MicroSD cards, and USB cables before. I've also heard Bluetooth being used, but I am not familiar with that technique. If you do end up setting up a server to do OTA, there is something you need to know. The webserver needs to have a MIME Type file updated so that it has the correct values for Jad/Jar file provisioning. They need to be:
jad text/
jar application/java-archive


Message was edited by: sfitzjava

Joined: 2008-12-01

Thanks sfitzjava, your suggestions are helpful. I don't want the alarm interrupting the user.