×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Cancelling a registered alarm in Push Registry

    hi all,
    I am registering an alarm through pushregistry every 5 seconds, so that if my app is closed unintentionally it will be restarted pretty soon... Now I was wondering how such an Alarm can be cancelled and/or un-registered ?
    Any ideas on this ?

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Cancelling a registered alarm in Push Registry

    Hmmm... register another alarm for a time in the past? Or a long way in the future?

  3. #3
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Cancelling a registered alarm in Push Registry

    I actually registered a new one for a very short period in the future (like 10ms) and then closed the app...
    seems like its working... guess the OS needs more than tohose 10 millisecs to close the app itself...

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Cancelling a registered alarm in Push Registry

    I can see potential problems with all solutions.

    * Time in the past: the spec doesn't say what this will do, so you'd be in the realms of "behaviour not defined". This might result in portability issues.

    * Time now (or very soon): some VMs will close faster than others. Some platforms might find that they can't deliver the message while the VM is shutting down, and queue it until the VM is shut down (resulting in an immediate restart).

    * Time in the distant future: say, one hundred years from now. Time might wrap around, with unpredictable results.

    The distant future is the only case where the behaviour is adequately defined. But, it has probably not been adequately tested.

    Safest approach: create a simple test app, that creates an alarm for 10 seconds in the future, then attempts to cancel it, using one of these strategies (chosen by the user (you)) to cancel it, and exits. Run this with all three strategies on as many phones as you can lay your hands on (better: get some minion to do it for you).

    Cheers,
    Graham.

  5. #5
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Cancelling a registered alarm in Push Registry

    fortunately in this case I only have to take into account one platform/device, on which I tested the a 100 ms alarm in the future and it works...
    But you're absolutely right regarding te testing if a solution should be found that supports several devices...
    Might I add that the lack of simply just cancelling such an Alarm is quite a big miss

  6. #6
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: Cancelling a registered alarm in Push Registry

    Hi,
    u can also try this to cancel the alarm..

    PushRegistry.registerAlarm(midlet name,0);
    thanks,
    jitu_goldie..

    KEEP TRYING..

  7. #7
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Cancelling a registered alarm in Push Registry

    oki after some searching I found the following :
    registerAlarm()


    Registers a timer-based alarm to launch the Midlet. Disables alarms if an argument of zero is passed

    at :
    http://developers.sun.com/mobility/m...icles/pushreg/

    Just as jitu_goldie advised... Even though this is not in official API documentation it's a SUN article so let's assume they're rigth

Similar Threads

  1. Push registry alarm notification.
    By chetubc in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2009-05-13, 06:17
  2. Expired Push Registry Alarm Behavior
    By tyrollin in forum Mobile Java General
    Replies: 2
    Last Post: 2009-02-06, 06:02
  3. Push Registry - Dynamic Alarm Registration
    By shereeb in forum Mobile Java General
    Replies: 5
    Last Post: 2009-02-02, 09:22
  4. Push Registry Register Alarm not working properly.
    By gaurav2610 in forum Mobile Java General
    Replies: 4
    Last Post: 2009-01-03, 03:01
  5. Push Registry alarm issue...
    By kumara1423 in forum Mobile Java General
    Replies: 2
    Last Post: 2007-05-23, 05:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×