wood burning stoves 2.0*
The moose likes Java Micro Edition and the fly likes How can i get my own phone number and my own emie number using PMI? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "How can i get my own phone number and my own emie number using PMI?" Watch "How can i get my own phone number and my own emie number using PMI?" New topic
Author

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

sampath premarathna
Greenhorn

Joined: Oct 05, 2010
Posts: 13
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

Joined: Oct 05, 2010
Posts: 13
Finally i found that there is no way to get phone number of it's own. so sad..
Olga Flasza
Greenhorn

Joined: Mar 26, 2010
Posts: 28
hi, can you point me how to get phone book details? many thanks
sampath premarathna
Greenhorn

Joined: Oct 05, 2010
Posts: 13
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i get my own phone number and my own emie number using PMI?