×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Jan 2004
    Posts
    56

    PushRegistry : how to cancel registered alarm

    Hi All,

    I've a midlet suite contains two midlets.
    When I exit one of midlets, it 'll use PushRegistry to automaticly start any of the midlets some times later based on the registered time.

    The problem is it'll mess up if I manually start the other midlet (not registered). so two midlets could start at the same time which is definalty not permitted.

    My question is: is there any way to cancel the registered alarm? or any way to prevent other midlet boot up when another midlet is running?

    Your any idea or hints will be grealty appreciated.

    Thanks in advance.
    Judy

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Moscow/Russia
    Posts
    258
    Try
    PushRegistry.registerAlarm("YourMidletClass", 0);

  3. #3
    Regular Contributor
    Join Date
    Jan 2004
    Posts
    56

    It works

    Hi Henson2K,

    Thank you ver much for your help. it works.
    it overwrites the registered alarms.

    Yeah, combined with other methods, like RMS, my app can work properly now.

  4. #4
    Registered User
    Join Date
    Oct 2007
    Posts
    8

    Re: PushRegistry : how to cancel registered alarm

    Hi Judyj2x,

    I am also facing the same problem, could u tell me how to use the

    PushRegistry.registerAlarm("YourMidletClass", 0) statement in the midlet, to cancel

    the register alarm.




    Thanks in adavance.

  5. #5
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: PushRegistry : how to cancel registered alarm

    You must read JSR specifications if you have any such type of query.

    I have copied and pasted the description of function registerAlarm:
    Code:
    registerAlarm
    
    public static long registerAlarm(String midlet,
                                     long time)
                              throws ClassNotFoundException,
                                     ConnectionNotFoundException
    
        Register a time to launch the specified application. The PushRegistry supports one outstanding wake up time per MIDlet in the current suite. An application is expected to use a TimerTask for notification of time based events while the application is running.
    
        If a wakeup time is already registered, the previous value will be returned, otherwise a zero is returned the first time the alarm is registered.
    
        Parameters:
            midlet - class name of the MIDlet within the current running MIDlet suite to be launched, when the alarm time has been reached. The named MIDlet MUST be registered in the descriptor file or the jar file manifest with a MIDlet-<n> record. This parameter has the same semantics as the MIDletClassName in the Push registration attribute defined above in the class description.
            time - time at which the MIDlet is to be executed in the format returned by Date.getTime() 
        Returns:
            the time at which the most recent execution of this MIDlet was scheduled to occur, in the format returned by Date.getTime() 
        Throws:
            ConnectionNotFoundException - if the runtime system does not support alarm based application launch 
            ClassNotFoundException - if the MIDlet class name can not be found in the current MIDlet suite or if this class is not included in any of the MIDlet-<n> records in the descriptor file or the jar file manifest or if the midlet argument is null 
            SecurityException - if the MIDlet does not have permission to register an alarm
        See Also:
            Date.getTime(), Timer, TimerTask

Posting Permissions

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