Hello everyone. I have a question I hope some can help me with. If I have a midlet with a registred alarm (PushRegistry.registerAlarm(midletClassName, nextAlarm)) how would the application know if it is started by an user or by the alarm?
The following code snippet from the PushRegistry entry in the API shows how to check if a session was started due to inbound connection notification. See the API for more info.
I think that is true when using connections (PushRegistry.registerConnection(String connection, String midlet, String filter) ) to receive incoming data not for alarms. Am I wrong?
The API doesn't provide a way of detecting whether or not the application was started by an alarm.
You could do something like this:
1) When you call registerAlarm() store the 'nextAlarm' value in RMS. 2) When the app starts compare the current time to the stored 'nextAlarm' value. If the current time is greater (but not too much greater) than 'nextAlarm', then the chances are that the application was started by the alarm.
I did that but I wasn't happy with it. But sure it looks the only way right now. I did try to use 2 midlets also that are identical one to be started by the user and one to be started by the alarm. It works but both (all) midlets are shown to the user in a Midlet Suite.
Thanks. /C
It's fun to be me, and still legal in 9 states! Wanna see my tiny ad?