This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i get my own phone number and my own emie number using PMI?

 
sampath premarathna
Greenhorn
Posts: 13
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am developing mobile application using PIM API.I wanted to get phone book details and the emie number and phone number of the application running phone.I was able to get phone book but i couldn't get the emie and the current mobile number of the user using. can anyone help me...

Thank you.
 
sampath premarathna
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally i found that there is no way to get phone number of it's own. so sad..
 
Olga Flasza
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, can you point me how to get phone book details? many thanks
 
sampath premarathna
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure .This is how i did it.

PIM pim = PIM.getInstance();
ContactList clist=(ContactList)pim.openPIMList(PIM.CONTACT_LIST,PIM.READ_WRITE);
Enumeration contacts = clist.items();

while (contacts.hasMoreElements()) {// going through all contacts
int namehave = contact.countValues(contact.NAME);//number of names this contact have
int tellhave = contact.countValues(contact.TEL);//number of contact numbers with differece type
int addhave = contact.countValues(contact.ADDR);

if (tellhave > 0) {
for (int i = 0; i < tellhave; i++) {//get the contact number for the related category for the contact
int telltype = contact.getAttributes(contact.TEL, i);

if (telltype == contact.ATTR_MOBILE) {
mobile = contact.getString(contact.TEL, i);//.......ATTR_HOME,...and there others
}
}//end of the for loop
}

//try to get names of the contact
if (namehave > 0) {
nameall = contact.getStringArray(contact.NAME, contact.ATTR_NONE);
fristName = (nameall[contact.NAME_GIVEN] != null) ? nameall[contact.NAME_GIVEN] : "no";//.........NAME_OTHER...,,and more
}//got the name

//try to get the address
if (addhave > 0) {
addrall = contact.getStringArray(contact.ADDR, contact.ATTR_NONE);//....ADDR_POST ...and more
}//end if got the address

//get the email of the contact
if (clist.isSupportedField(contact.EMAIL)) {
if (contact.countValues(contact.EMAIL) > 0) {
email = (contact.getString(contact.EMAIL, 0) != null) ? contact.getString(contact.EMAIL, 0) : "no";
}
}
}//end while
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic