×

Discussion Board

Results 1 to 12 of 12

Hybrid View

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

    PIM Issue & Sim Contacts read problem

    I want some Nokia Champ or Pro Developer to answer my Question as I have already been given so many suggestions and solutions but none of them worked. I have designed a j2me application which reads contacts from SIM and Phone memory after selecting options (From Sim, From Phone) individually. I have problems in here which I think are from the Nokia Devices as I tried that over almost 30 to 50 mobile sets.

    Problem is defined here
    1- When reading contacts either from SIM or Phone for the very first time of the application is installed/Downloaded/Put into the phone, when I try to read contacts the application hangs there no matter how long I wait it doesn't work, and when I restart the application, it works fine. Now I want to ask whether this issue is genuinely in Nokia devices? because I tried to put even simplest lines of code to read contacts but on the very first time it always hang. Point to note that my application is signed from VeriSign and if run without certificate it works fine as it doesn't ask me for "Always" permission. So what I concluded is that when I select always permissions, it either unable to set those permissions at the first time or what else? I am posting the simplest code I used as I was suggested by some Nokia Developer to put code in Thread so did I but the same issue persists, and it actually messing up my development of the application. I need to resolve this issue at any cost. Here is the code

    Code:
    public void ReadContacts extends Thread{
                public void run(){
           try {
                boolean doWrite = true;
                contacts.removeAllElements();
                pim = PIM.getInstance();
                String lists[] = pim.listPIMLists(PIM.CONTACT_LIST);
                for (int i = 0; i < lists.length; i++) {
                    //code for custom backup operation
                    if (customCode == 1 && i == 0) {
                        continue;
                    } else if (customCode == 0 && i > 0) {
                        continue;
                    }
                    clist = (ContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY, lists[i]);
                    Enumeration cenum = clist.items();
                    while (cenum.hasMoreElements()) {
                        Contact c = (Contact) cenum.nextElement();
                        ContactDTO contact = new ContactDTO();
                        parseContactInfo(c, contact);
                        if (customCode == 2 && i > 0) {
                            Enumeration cenum1 = contacts.elements();
                            ContactDTO contact1;
                            while (cenum1.hasMoreElements()) {
                                contact1 = (ContactDTO) cenum1.nextElement();
                                if (contact1.getName().equals(contact.getName())) {
                                    if (contact1.getCodedString().equals(contact.getCodedString())) {
                                        doWrite = false;
                                        break;
                                    } else {
                                        doWrite = true;
                                    }
                                }
                            }
                        }
                        if (doWrite) {
                            contacts.addElement(contact);
                        }
                    }
                    clist.close();
                }
            } catch (Exception e) {
          }
       }
    }
    ---of course I have this code modified according to my needs, but even if I use it's simplest form(just reading part) it still behaves like that, so don't ask me to put that code as you can understand what I mean, thanks---

    [Edit: Removed second part to put as new thread thinking that people may get interest to that too being individual and prominent]
    Last edited by saqibatiq; 2013-03-13 at 06:47.

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,104

    Re: PIM Issue & Sim Contacts read problem

    No concrete suggestion, just some ideas: Have you played with on-device-debugging to find the line of code? Have you played around with Thread.yield()?

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

    Re: PIM Issue & Sim Contacts read problem

    Quote Originally Posted by traud View Post
    No concrete suggestion, just some ideas: Have you played with on-device-debugging to find the line of code? Have you played around with Thread.yield()?
    What I know is the issue comes when for the very first time it tries to open the PIM list and there it hangs, afterwards, as no permissions are asked because I have selected that at very first time start, so it works fine. I don't know why does it happens? and thing to note is that I tried it over Samsung GT-E2252 where it works absolutely fine. What I wanted to know was is there anyone else who had similar issue with hanging while reading contacts?

    and as far as for second issue, I don't know why only old devices cause this error? talking about debugging on device if I had code issue it shouldn't have run over a number of devices too...

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,104

    Re: PIM Issue & Sim Contacts read problem

    Sometimes, knowing the concrete line of code which hangs, brings up an idea to work-around this issue. Your descriptions sounds like a bug from Nokia. Well, now is the phase to workaround it. Perhaps some calls create a new thread which is still waiting. i never read about your issue, and that issue should be quite common.

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

    Re: PIM Issue & Sim Contacts read problem

    Is it possible that something on another Thread is calling Display.setCurrent()... and that the new Displayable is hiding the permission dialogue?

    Is this problem occuring on S40 or S60 devices?

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

    Re: PIM Issue & Sim Contacts read problem

    Quote Originally Posted by grahamhughes View Post
    Is it possible that something on another Thread is calling Display.setCurrent()... and that the new Displayable is hiding the permission dialogue?

    Is this problem occuring on S40 or S60 devices?
    Does that effect anyway? I mean if I have a separate thread for permissions and if hiding dialog, it shouldn't work further until I give permissions. And as I do give permissions it hangs there no matter what I do or how, the very first time it has to hang. And this issue occurring over S40 devices as s60 devices (most of them) do not provide always permission. And on other models than Nokia I have no such issue, which means there is a bug in Nokia s40 devices.

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

    Re: PIM Issue & Sim Contacts read problem

    Quote Originally Posted by traud View Post
    Sometimes, knowing the concrete line of code which hangs, brings up an idea to work-around this issue. Your descriptions sounds like a bug from Nokia. Well, now is the phase to workaround it. Perhaps some calls create a new thread which is still waiting. i never read about your issue, and that issue should be quite common.
    Yes this issue need to be checked, I don't know whether someone else face same problem or not but on the latest devices I used with "Always" permission, that is on most of the new devices, behave like this.

Similar Threads

  1. problem in read contacts
    By sh3at in forum Symbian C++
    Replies: 1
    Last Post: 2011-07-14, 08:34
  2. How to read contacts
    By sreehari434 in forum Mobile Java General
    Replies: 8
    Last Post: 2009-11-28, 05:51
  3. AT command issue to read contacts
    By mukeshkb4u in forum General Messaging
    Replies: 0
    Last Post: 2009-03-30, 08:10
  4. Replies: 13
    Last Post: 2008-07-23, 17:06
  5. read contacts in S40
    By oscarm in forum Mobile Java General
    Replies: 6
    Last Post: 2008-02-27, 17:13

Posting Permissions

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