×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    8

    How do I read phonebook Contacts using PIM API in N70

    Hello everyone,

    I am trying to read phone Contact list in a N70 phone, but I am not being able to get it.When i try it on the WTK emulator it works comletely fine, but when I run it on the N70 phone it does not show me anything.

    I have the following doubts...

    1. I have created a vCard and stored it in the C:\WTK2.5.1\appdb\DefaultColorPhone\pim\contacts\Contacts
    folder and while reading from the emulator it displays the phone number from here. But on the real device how does it look up into the Contact List?

    2. If I have to read a phone number from the contact List of my phone then what are the steps that I should follow to do that? Do I need to use the method importContact()?

    My function that tries to read the phone number is attached below,

    Code:
    public String read_data()
        {
            String mesg = null;
            try
            {
                cList = (ContactList)PIMList(PIM.CONTACT_LIST,PIM.READ_WRITE);
                contacts = cList.items();
                c = (Contact) contacts.nextElement();
                int tel = c.countValues(Contact.TEL);
                for(int i=0; i<tel; i++)
                {
                    if ((c.getAttributes(Contact.TEL,i) != 0 ) & Contact.ATTR_HOME != 0)
                    {
                        mesg = c.getString(Contact.TEL,i);
                    }
                }
                System.out.println("The telephone Number is : " + mesg);
            }
            catch(Exception e)
            {
                mesg = "Error in Reading data";
            }
            return mesg;
            
        }
    Thanks a Lot,
    Ayan

  2. #2
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: How do I read phonebook Contacts using PIM API in N70

    Hello ayan_sen,
    I ve been reading phonebook using PIM and had no problem with it on s40 and also on s60
    Thoes are lines of my code which i used. There are some differances when i compare it with yours, you should combine them:

    PIM singleton = PIM.getInstance();
    ContactList cl = null;

    cl = (ContactList)singleton.openPIMList(PIM.CONTACT_LIST,PIM.READ_ONLY);
    Enumeration zestawienie = cl.items();

    contact2 = (Contact) zestawienie.nextElement();

    contact2.getString( Contact.TEL, j )

    You should also try to check if fields are supported by your mobile using:

    cl.isSupportedField(Contact.TEL))


    At the begining my application worked properly on my s40 phone but when i installed it on my s60 phone it did not work cuz one field was not supported

    i hope it will work

    Good luck

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    8

    Re: How do I read phonebook Contacts using PIM API in N70

    thanks a lot nuker85,

    it started working when I changed the permission to READ_ONLY in

    cList = (ContactList)PIMList(PIM.CONTACT_LIST,PIM.READ_WRITE);

    But if I want to update my Contact List in my mobile phone from my application
    then I have to have READ_WRITE permissions. How can I have that?

    Regards

    Ayan

  4. #4
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: How do I read phonebook Contacts using PIM API in N70

    Good to hear that it works.
    My application only reads contacts from phonebook
    Maybe this link ill help you:

    http://www.java-tips.org/java-me-tip...phonebook.html

    good luck

  5. #5
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: How do I read phonebook Contacts using PIM API in N70

    Can you check what API access settings you have for edit user data for your MIDlet (you can find those settings through the application manager). It could be that you are getting a security exception...

    Hartti

Similar Threads

  1. PIM Api and fromSerialFormat()
    By divyas in forum Mobile Java General
    Replies: 10
    Last Post: 2009-10-28, 11:47
  2. Accessing SIM contacts using PIM API (JSR 75)
    By sunil_talent in forum Mobile Java General
    Replies: 4
    Last Post: 2009-02-06, 18:08
  3. N70 audio api problem
    By nhamel in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2006-10-10, 12:35
  4. Replies: 3
    Last Post: 2006-07-18, 11:09
  5. AT+CPBR to read 8250 phonebook
    By b3b3n in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-05-23, 10:42

Posting Permissions

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