• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

Midlet and PushRegistry.registerAlarm

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
It's fun to be me, and still legal in 9 states! Wanna see my tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic