Reputation: 615
I am developing Loaction Alarm app in j2me. The purpose of my app is to alert user once he/she will reach to his/her desire location on which he/she set reminder.I want this must be happen when user close the app. For that I have to run my code in background which continuously check whether coordinates came from GPS is same as coordinates set in reminder. Once condition get true app will automatically prompt with an map(showing on Canvas) & alertbox or form(to show reminder text) with music tone. How should I done this???? Is any one done this before then plzz share your experience or code as soon as possible....
Note: In app, Maximum 5 reminders user can set so that I have to check 5 reminders coordinates continuously & simultaneously.
And I also want that when user close an app, excluding background running code other forms & controls should free the resources(i.e.should get delete) they are using & that should be again created when user start an app.
Upvotes: 0
Views: 1211
Reputation: 4776
Also note that if you are targeting Nokia S40 Phones then It is not possible to run a background application because it is not a Multi-tasking OS. Have a look at below and see if that helps: http://www.dailyteck.com/how-can-be-run-multitasking-or-minimizing-application-in-nokia-s40-mobile-phones/
Upvotes: 1
Reputation: 1920
A JavaME app can be started automatically using PushRegistry. But PushRegistry has limited methods. You can start an app by an SMS, or an alarm for example. But there's no GPS location autostart feature in PushRegistry, so you can't use PushRegistry as a solution. In other words: Once your JavaME is closed, then it's closed and you can't autostart it again when GPS data matches a certain location.
So, you have to leave your app running in the background, and have it fetch GPS data. Instead of a "Close" button, you could create a "Hide" button. You hide your app like this:
Display.setCurrent(null);
(It (like anything else in JavaME) doesn't work on all devices though). When GPS data matches a certain location, then you do
Display.setCurrent(yourDisplayable);
And then you display the alarm.
Upvotes: 1