Question

I want to read contact details like firstname , lastname, mobile no, telephone , fax, address, synchronization and UID details using PIM apis in Nokia S60 sdk.

But , I am getting only Contact.TEL and Contact.EMAIL value, none of the other values I am getting , although, I am able to see other fields like first name, last name in the emulator contact details.

I have configures all the required permission .

ContactList addressbook = (ContactList) (PIM.getInstance().openPIMList(
PIM.CONTACT_LIST, PIM.READ_ONLY));
Contact contact = null;

Enumeration items = addressbook.items();
while (items.hasMoreElements()) {
String name = "";
String telephone = "";
String mobile = "";
String email = "";
String InternetTelephone = "";
String Company = "";
String JobTitle = "";
String Synchronisation = "";
String UID = "";
String LastModified = "";
String contactRow = "";
System.out.println("\n *** NEW ITEM  ***");
contact = (Contact) (items.nextElement());
System.out.println(" * contact : " + contact.toString());
try {      
name = contact.getString(Contact.FORMATTED_NAME, 0);
System.out.println("Name = " + name);
} catch (Exception ex) {
 System.out.println(" Name  error "+ ex.getMessage());
}

try {       
mobile = contact.getString(Contact.ATTR_MOBILE, 0);
System.out.println("Name = " + name);
} catch (Exception ex) {
 System.out.println(" Name  error "+ ex.getMessage());
}


try
{   telephone = contact.getString(Contact.TEL, 0);
System.out.println("Telephone = " + contact.getString(115, 0)); //field 115: Telephone
} catch (Exception ex) {
System.out.println(" Telephone  error "+ ex.getMessage());
}

try
{      
email = contact.getString(Contact.EMAIL, 0);
System.out.println("E-mail = " + contact.getString(103, 0)); 
} catch (Exception ex) {
 System.out.println(" E-mail  error "+ ex.getMessage());
}

try
{ 
UID = contact.getString(Contact.UID, 0);
System.out.println(" UID " + UID ); 
} catch (Exception ex) {
System.out.println(" UID  error "+ ex.getMessage());
}

try
{
LastModified = contact.getString(114, 0);
System.out.println(" Last modified " + contact.getString(114, 0)); 
} catch (Exception ex) {
System.out.println(" Last modified error "+ ex.getMessage());
}

looking forward your valuable suggestions.

Thanks in advance.

Was it helpful?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top