• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Midlet and PushRegistry.registerAlarm

 
Con Rea
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Anyone?
Anything?

Thanks
/C
 
Tomas Conway
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Con Rea
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Tomas

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?

/C
 
Tomas Conway
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Con, I wasn't paying attention.

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.
 
Con Rea
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you again.

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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic