×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    6

    Unhappy registerAlarm exception

    Hi
    am trying to schedule a midlet to run on a 6320i (S40) using registerAlarm but the call keeps throwing a java.io.IOException: Insufficient resources to handle request.

    Any ideas/help greatly appreciated.
    Thanx

    Code extract
    private void scheduleMIDlet(long deltatime)
    {
    long now = System.currentTimeMillis();
    Date date = new java.util.Date(now);
    long timeToSet = date.getTime() + deltatime;
    try{
    PushRegistry.registerAlarm(this.getClass().getName(),timeToSet );
    }
    catch (Exception e)
    {//make sure we see the error during development
    throw new RuntimeException("Unable to push: " + e);
    }
    }

  2. #2
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: registerAlarm exception

    Hi issw,

    IOException is thrown when:

    "The connection is already registered, or there are insufficient resources to handle the registration."

    Also, note the following:

    "Passing a time of zero disables the alarm. Note that only one outstanding alarm per MIDlet is supported, and invoking this method overwrites any previously scheduled alarm."

    and

    "At most, only one alarm can be registered per registry entry."

    For more info on PR, check the article below:

    The MIDP 2.0 Push Registry
    http://developers.sun.com/techtopics...icles/pushreg/

    Hope it helps!

    BR,

    Juarez Jr

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    6

    Unhappy Re: registerAlarm exception

    Hi Juarez
    thanks for reply. Further testing etc reveals that the midlet schedules fine until a prompt to allow it to run is missed. Once missed, the exceptions are thrown when either trying to cancel an alarm eg PushRegistry.registerAlarm(this.getClass().getName(), 0) or schedule one. Tried deleting the midlet and re-downloading OTA but seems to always throw exception. Is there a way to clear whatever is lingering about causing the issue?
    Thanks again
    issw

  4. #4
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: registerAlarm exception

    Hi issw,

    "Is there a way to clear whatever is lingering about causing the issue?"

    AFAIK you can disable an alarm by passing zero as the time argument.

    Also, note the long value being returned by this method - public static long registerAlarm(String midlet, long time). Maybe it can help you figure out what's happening.

    "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."

    What exceptions are being thrown?

    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

    Once again, check the - Table 2 PushRegistry Exceptions - below it can help debugging:

    The MIDP 2.0 Push Registry
    http://developers.sun.com/techtopics...icles/pushreg/

    Hope it helps

    BR,

    Juarez Jr

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    6

    Unhappy Re: registerAlarm exception

    Hi Juarez
    again, thanks for reply...
    The problem is that the call to PushRegistry.registerAlarm is not returning but throwing an exception...java.io.IOException: Insufficient resources to handle request.

    Initially all seems to work fine, as expected but... possibly if a prompt to start the midlet is not acknowledged and disappears to where ever, all subsequent calls to the PushRegistry.registerAlarm result in the exception being thrown. Deleteing and re-installing the midlet does not clear this issue, cycling the power etc seems to have no effect.

    I am trying to ascertain the exact steps to replicate this behaviour, which I will post when documented. Problem is that once in this state it is difficult to clear... one of those things that cleared itself overnight.!!!??

    Again, thanks for comments

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    2

    Re: registerAlarm exception

    I came across this forum post while trying to solve the same problem.

    It appears there's a bug in Nokia's AMS on the 6320i at least (maybe on some other phones? I've only tested on the 6320).

    As you say, when you miss the "reminder" prompt to allow the MIDlet to run when the alarm activates it, the registerAlarm() function breaks totally.

    I did find a way to "un"-break it though. All you need is to registerAlarm() using a MIDlet of a different name to the one which it was trying to run when it broke, and then successfully accept the "reminder" prompt.

    After that, you can go back to the original MIDlet and registerAlarm() should work fine.

    All I did was rename my MIDlet, get registerAlarm() to run it, and then I renamed it back again.

    Hope this helps somebody.

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    2

    Re: registerAlarm exception

    Ok, just replicated it one more time. I still had to wait for a while for the AMS to sort itself out, somewhere around 15-30min.

  8. #8
    Registered User
    Join Date
    Nov 2005
    Posts
    14

    Re: registerAlarm exception

    I tried all the things posted here, but I still got that error message. In adittion if I create new MIDlets (rename the name of the old one) it seems that works, no exception is thrown, but the MIDlet does not wake up anymore. Any suggestions?

    Thanks in advance.
    Bruno

Similar Threads

  1. VS.Net 2003 Carbide 2.01 and epoc32.exe
    By ValentinK in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2007-01-12, 12:31
  2. First-chance exception in emulator S60 3rd ed.
    By darioses in forum Symbian Tools & SDKs
    Replies: 6
    Last Post: 2006-04-25, 18:24
  3. Replies: 2
    Last Post: 2004-11-17, 10:20
  4. Catching an exception
    By btnokdev in forum Mobile Java General
    Replies: 2
    Last Post: 2003-10-11, 14:45
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

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