Hi all,
Is it possible to retrieve the sim contacts?
Here its possible to retrieve the contacts from phone contacts only.
How to retrieve the sim contacts and add the new contact to sim?
Regards,
Bharath.C
Hi all,
Is it possible to retrieve the sim contacts?
Here its possible to retrieve the contacts from phone contacts only.
How to retrieve the sim contacts and add the new contact to sim?
Regards,
Bharath.C
Yes, all this is possible on using JSR -75 PIM api's on Nokia S40 devices.
refer to FN wiki -
http://wiki.forum.nokia.com/index.ph...ook_in_Java_ME
http://wiki.forum.nokia.com/index.ph...act_in_Java_ME
http://wiki.forum.nokia.com/index.ph...cts_in_Java_ME
or refer to PDAPDemo PIM example of WKT
using String[] lists = pim.listPIMLists(PIM.CONTACT_LIST);
Code:PIM pim = PIM.getInstance(); String[] lists = pim.listPIMLists(PIM.CONTACT_LIST); // you get the list 0 and 1, where 0 is sim list and 1 is phone book list for (int i = 0; i < lists.length; i++) // get both phone book memorry and SIM card { PIMList list = null; try { list = pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY, lists[i]); } catch (PIMException e) { } // do what you want with the PIM list of both add,edit,delete and then close the list. }
Thanks,
Ekta
Is this working for you?
I cant retrieve the SIM contacts.
I can retrieve Only phonecontacts.
How to retrieve the SIM contacts?
Regards,
Bharath...
On which device you are testing it ?
just try this:
PIM pim = PIM.getInstance();
String[] lists = pim.listPIMLists(PIM.CONTACT_LIST); // you get the list 0 and 1, where 0 is sim list and 1 is phone book list
And print the no. of lists you get in this Response.....
Using this you can access SIM contact book on S40, I have tested this on Nokia 6500 slider.
Thanks,
Ekta
I tested on 2700 classic.
Its reading the SIM numbers.
But i cant retrieve the values from SIM, It retrieve the phone contacts value only.
Regards,
Bharath.c
You say "Its reading the SIM numbers" but you cant retrieve the values from SIM.... what do you mean by this... if you are able read the contact Objects from SIM card... you are not able to get the phone numbers or name. Are you trying Contact.FormatedName or only Contact.Name or Contact.Tel?
Thanks,
Ekta
Thanks Ekta....
Most of the problem was solved but i have 1 more problem.
I cant retrieve the some telephone number from phone contacts.
I was created the contact as general format.
I used all attributes for retrieve the telephone numbers.
Like,
int phoneNumbers = c.countValues(Contact.TEL);
if (value == Contact.TEL && phoneNumbers > 0) {
for (int i = 0; i < phoneNumbers; i++) {
if (c.getAttributes(Contact.TEL, i) == Contact.ATTR_HOME) {
String homeNo = c.getString(Contact.TEL, i);
} else if (c.getAttributes(Contact.TEL, i) == Contact.ATTR_FAX) {
String faxNo = c.getString(Contact.TEL, i);
} else if (c.getAttributes(Contact.TEL, i) == Contact.ATTR_WORK) {
String workNo = c.getString(Contact.TEL, i);
} else if (c.getAttributes(Contact.TEL, i) == Contact.ATTR_MOBILE) {
String mobileNo = c.getString(Contact.TEL, i);
} else if (c.getAttributes(Contact.TEL, i) == Contact.ATTR_NONE || c.getAttributes(Contact.TEL, i) == Contact.ATTR_OTHER || c.getAttributes(Contact.TEL, i) == Contact.ATTR_AUTO || c.getAttributes(Contact.TEL, i) == Contact.ATTR_PREFERRED || c.getAttributes(Contact.TEL, i) == Contact.ATTR_ASST || c.getAttributes(Contact.TEL, i) == Contact.ATTR_PAGER || c.getAttributes(Contact.TEL, i) == Contact.ATTR_SMS) {
String otherNo = c.getString(Contact.TEL, i);
}
Is this correct?
Some telephone numbers not comes into the any conditions.
Regards,
Bharath...
Last edited by bhakki; 2010-06-22 at 12:20.
Some telephone don't come because they might not be defined in this way -
try
Code:// Numbers private static String[] attrDescList = { ATTR_ASST, ATTR_AUTO, ATTR_FAX, ATTR_HOME, ATTR_MOBILE, ATTR_OTHER, ATTR_PAGER, ATTR_PREFERRED, ATTR_SMS, ATTR_WORK }; int n = contact.countValues(Contact.TEL); if(n>0) { for (int k = 0; k < n; k++) { int attrs = contact.getAttributes(Contact.TEL, k); try { String tel = contact.getString(Contact.TEL, k); System.out.println("attrs: "+attrDescList [attrs]+ " " +Tel :" +tel); } catch (IndexOutOfBoundsException ex) { } } }
Thanks,
Ekta
Hi,
I think this is problem with s40 series mobiles.
Because this problem only occured when i retrieving the contact as general format.
I dont know How to resolve this issue????
I got the contact.countValues(Contact.TEL) is 0 when i retrieving the general contacts in s40 mobiles.
So i cant get the telephone number.
Is there any way to get the general contact number from phone contacts in s40 series mobiles?
Bharath... :)
http://library.forum.nokia.com/index...59BE55914.html
On S40 see you can get both the Contact list from phone memory and Sim cards. I have tested this on Nokia 6500 slider and few other devices like 3110 etc.
Are you testing it on real device ? try on some other device --- also try SUN WTK PDAPDemo PIM example on your target devices and see what all it is able to read from PIM
Thanks,
Ekta
I tested PDAPDemo on real time nokia 2700 classic mobile.
Here also i faced same problem.
In this application, general contact phone number could not be read.
Bharath... :)
Ok. but i got contact.countValues(Contact.TEL) is 0.
So i cant get the telephone number.
Bharath... :)
Hey guys,
I have a Nokia 3720 Classic. How can I retrieve the deleted contacts from my SIM card?