×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Nov 2012
    Location
    Lahore, Pakista
    Posts
    58

    Signed J2me app Hanging problem at first start

    in my j2me app that is signed by veri sign, has problem in accepting the always or yes permissions the time it has to perform PIM.getInstance().open.... action perform.
    When my app perform below line of code very first time of it's installation it hangs and doesn't show up the main screen rather a black background hanged screen. When I exit and
    restart the application it runs normally without any problem even if I delete it and download again and runs fine, except I delete and restart the phone and try to run it again it shows the same
    problem I described above.
    my code of line that causes to ask permissions is here that actually also causes the problem. I am at the end and now it's showing this error, i really need help. Thanks

    private void permissionSettings() throws PIMException {
    PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
    }

    that's it

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Signed J2me app Hanging problem at first start

    Quote Originally Posted by saqibatiq View Post
    in my j2me app that is signed by veri sign, has problem in accepting the always or yes permissions the time it has to perform PIM.getInstance().open.... action perform.
    When my app perform below line of code very first time of it's installation it hangs and doesn't show up the main screen rather a black background hanged screen. When I exit and
    restart the application it runs normally without any problem even if I delete it and download again and runs fine, except I delete and restart the phone and try to run it again it shows the same
    problem I described above.
    my code of line that causes to ask permissions is here that actually also causes the problem. I am at the end and now it's showing this error, i really need help. Thanks

    private void permissionSettings() throws PIMException {
    PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
    }

    that's it
    On 1st launch of the app on the device, before reading PIM data (above line) educate the user for giving the required PIM access permissions to app via settings...

    Are you installing this app via JAD -OTA and have you asked for required permissions in JAD.... ?

    Which is your target device - if you install the app, setup the permissions from App setting and then launch the app - does it works good?
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  3. #3
    Registered User
    Join Date
    Nov 2012
    Location
    Lahore, Pakista
    Posts
    58

    Smile Re: Signed J2me app Hanging problem at first start

    Quote Originally Posted by im2amit View Post
    On 1st launch of the app on the device, before reading PIM data (above line) educate the user for giving the required PIM access permissions to app via settings...

    Are you installing this app via JAD -OTA and have you asked for required permissions in JAD.... ?

    Which is your target device - if you install the app, setup the permissions from App setting and then launch the app - does it works good?
    Exactly it educates user about granting permissions for Read and Edit user data. I have both OTA and Offline file available, no matter which way I do it shows the same error. One more thing as you asked about the target device I have this problem over Nokia x2-02, x2-05, c2-02 and Asha 200. On all these devices it has same problem but amazingly on c3-02 it runs without any error, the reason could be it's different behavior as it doesn't give option of permissions as (Yes, Always, No) rather it gives Yes and if I have to set it to Always I shall manually edit its settings.

    In my JAD I have set all the permissions required. If I add permissions manually it works fine but thing I wonder is why doesn't it start the very first time. Yes there is always a second solution but I want to run it the way it should. No problem at very first time. Any idea what changes should I do? thanks for your reply!

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Signed J2me app Hanging problem at first start

    Quote Originally Posted by saqibatiq View Post
    Exactly it educates user about granting permissions for Read and Edit user data. I have both OTA and Offline file available, no matter which way I do it shows the same error. One more thing as you asked about the target device I have this problem over Nokia x2-02, x2-05, c2-02 and Asha 200. On all these devices it has same problem but amazingly on c3-02 it runs without any error, the reason could be it's different behavior as it doesn't give option of permissions as (Yes, Always, No) rather it gives Yes and if I have to set it to Always I shall manually edit its settings.

    In my JAD I have set all the permissions required. If I add permissions manually it works fine but thing I wonder is why doesn't it start the very first time. Yes there is always a second solution but I want to run it the way it should. No problem at very first time. Any idea what changes should I do? thanks for your reply!
    The Black background and UI geting stuck on this PIM operation - may be because of some type of UI dead-lock, check if you are trying the access the PIM from a thread that is independent of UI - repaint / refresh?
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  5. #5
    Registered User
    Join Date
    Nov 2012
    Location
    Lahore, Pakista
    Posts
    58

    Re: Signed J2me app Hanging problem at first start

    Quote Originally Posted by im2amit View Post
    The Black background and UI geting stuck on this PIM operation - may be because of some type of UI dead-lock, check if you are trying the access the PIM from a thread that is independent of UI - repaint / refresh?
    Hi @im2amit, thanks for the suggestion I came to know that issue is in opening ports for sending and receiving SMS and in emulator it warns me to use different thread for that than using in commandAction(). So what I did is to create new thread even a new thread class and put all that code (for sending) SMS in that and then call it there but still it shows the same issue, either m not getting what does different thread mean or there is some bug I couldn't find. Would please like to elaborate it a bite more? thanks
    Last edited by saqibatiq; 2013-01-08 at 05:36. Reason: Found the issue I discussing but still wondering to find next step

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Signed J2me app Hanging problem at first start

    Quote Originally Posted by saqibatiq View Post
    Hi @im2amit, thanks for the suggestion I came to know that issue is in opening ports for sending and receiving SMS and in emulator it warns me to use different thread for that than using in commandAction(). So what I did is to create new thread even a new thread class and put all that code (for sending) SMS in that and then call it there but still it shows the same issue, either m not getting what does different thread mean or there is some bug I couldn't find. Would please like to elaborate it a bite more? thanks
    Cut & Paste your codelet - where you are calling this new thread to send SMS from CommandAction()
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  7. #7
    Registered User
    Join Date
    Nov 2012
    Location
    Lahore, Pakista
    Posts
    58

    Re: Signed J2me app Hanging problem at first start

    Quote Originally Posted by im2amit View Post
    Cut & Paste your codelet - where you are calling this new thread to send SMS from CommandAction()
    Well what does it mean by in CommandAction() because in my code I have to call this code from a specific class that doesn't belong to commandAction() or I cannot directly call it from there, so far SMS is being sent successfully but what comes in between now is PIM, it asks for the Permission as I press Always, after that it hangs there and then I have to force shut down it. I want to mention that I am using thread for reading PIM list, but vain. I am actually confused about the thing happening... Sorry for bothering you but thats the only way I am getting closer.... thanks

  8. #8
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Signed J2me app Hanging problem at first start

    The UI thread of the app - the UI flow - paint/repaint() or CommandAction() or methods called from Actionhandelers() should not do any blocking operations like reading PIM / RMS or sending SMS.... all these types of operations should be done using threads and these threads should just be stared from Actionhandelers(). Check how are you trying to do it.... hope you are not waiting the read the PIM before controls returns to CommandAction()... which is causing this UI deadlock on some devices.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  9. #9
    Registered User
    Join Date
    Nov 2012
    Location
    Lahore, Pakista
    Posts
    58

    Re: Signed J2me app Hanging problem at first start

    Quote Originally Posted by im2amit View Post
    The UI thread of the app - the UI flow - paint/repaint() or CommandAction() or methods called from Actionhandelers() should not do any blocking operations like reading PIM / RMS or sending SMS.... all these types of operations should be done using threads and these threads should just be stared from Actionhandelers(). Check how are you trying to do it.... hope you are not waiting the read the PIM before controls returns to CommandAction()... which is causing this UI deadlock on some devices.
    You been a great help, I am finally reached to the main problem and found the reason why it's hanging. But strange thing happening is that it is only happening over a few Nokia models Like I mentioned before Nokia x2-05 but not over Nokia x3-02.

    public final void reloadContacts() throws PIMException {
    contacts.removeAllElements();
    pim = PIM.getInstance();
    String lists[] = pim.listPIMLists(PIM.CONTACT_LIST); //asks for read permission

    for (int i = 0; i < lists.length; i++) {
    clist = (ContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE, lists[i]); //asks for edit permission
    Enumeration cenum = clist.items();
    while (cenum.hasMoreElements()) {
    Contact c = (Contact) cenum.nextElement();
    ContactDTO contact = new ContactDTO();
    this.parseContactInfo(c, contact);
    contacts.addElement(contact);
    }
    clist.close();
    }
    }

    this piece of code I run separately (not in CommandAction()), on emulator it doesn't now warns me with Warning of different thread start, but still it hangs over read/edit permissions in mobile phone. I know it's solely a phone model issue but this same piece of code runs when I second time run the application and then goes on no matter how many times I run it. Which makes me to think that there must be some way that I can somehow read permission before and save it somehow so that it could be used for this code later on, but I don't know how. For the last do you have any idea for my logic I defined here and looking at the comments I posted before, to solve this issue? Because now the issue of different thread etc has not been involved. I seek for a good logic that could possibly work. Thanks for your time!

  10. #10
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Signed J2me app Hanging problem at first start

    From where this method is called ? What the app is doing in the main UI thread at that time ?
    Are you starting a new thread to call this method ?
    Please cut&paste the code block that calls this methods - reloadContacts()
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  11. #11
    Registered User
    Join Date
    Nov 2012
    Location
    Lahore, Pakista
    Posts
    58

    Re: Signed J2me app Hanging problem at first start

    Quote Originally Posted by im2amit View Post
    From where this method is called ? What the app is doing in the main UI thread at that time ?
    Are you starting a new thread to call this method ?
    Please cut&paste the code block that calls this methods - reloadContacts()
    I run this code from a thread, constructor and for checking reason just a single start method without any commandAction() code there. But in all situations it generates the same problem. I know that issue is in some particular devices but I cannot simply ignore them, I have to find some way to do this. What the best way can be?

    At the time I call this method my UI is doing nothing, just initializes my variables and shows the mainForm that's it. The problem, I guess, not been code specific now rather it's been platform specific. I want to know if someone else also ever had this problem or what you suggest for this. Thanks once again

Similar Threads

  1. [Moved]Hanging while connecting to network in J2ME applicaation
    By mahesh.kmrao in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2011-07-04, 15:10
  2. Hanging while connecting to network in J2ME applicaation
    By mahesh.kmrao in forum [Closed] Publishing to Nokia Store
    Replies: 1
    Last Post: 2011-07-04, 15:05
  3. Problem to install signed j2me app to S40. S60works fine
    By teamforce_paul in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2009-12-21, 12:21
  4. Replies: 3
    Last Post: 2009-05-21, 11:18
  5. Problem start-up: sound control in J2ME
    By wyi in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2007-04-27, 09:22

Posting Permissions

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