tags:

views:

745

answers:

4

I need my J2ME app to run in the background and still allow the user to use his mobile without problem. the app still needs to process some events in the background.

I would also like to allow the user to stop the app if he wants to.

How can I accomplish this?

A: 
MIDlet.notifyPaused()
Adinochestva
I need the midlet to continue running in the background (interface not showing, minimized like in the case of desktop app). it is my understanding that using the method notifyPaused() will momentarily pause the execution of the midlet.
Attilah
But what if your phone does not call this 'notifyPaused()' callback method?Instead, your phone may be very low on resources and decides to close yourJ2ME program all together
joe
This tells the midlet to pause not detect pause methods.
drubin
+1  A: 

Running a midlet in the background but still processing is not specified in the j2me standard i think. Normaly at the moment your midlet is moved to background the paused method should be called.

But not every vendor implements it that way. Symbian keeps your program running as if there was no change when minimized. At least on the N80 and N90.

Janusz
A: 

If you app is in background then it doesn't receive any events. So I don't know how it can process any event in the background. If its a preload J2ME app then you can work with the handset manufacturer and obtain certain jad attributes to put your midlet in background. You can thus not allow the user to exit the app. You may want to think this use case through.

On the other hand you can do all these in Blackberry apps.

omermuhammed
i mean when my app is in the background, it will still occasionally send sms to a predefined number in maybe a separate thread. is that possible ?
Attilah
You may not be able to do that. However, you can keep a HTTP connection open, send a message to a web page that sends the sms to that number.
omermuhammed
+1  A: 

This is not always supported, but on the handsets that do, the command is:

Display.getDisplay(theMidlet).setCurrent(null);
funkybro