How can I get phone no of device??

Put your problem here if it does not fit any of the other categories.

How can I get phone no of device??

Postby abhishek.s » Mon May 31, 2010 2:18 pm

I used following code to retrive phne no. but its giving null on my android nexus one device.


TelephonyManager mTelephonyMgr;
mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
mTelephonyMgr.getLine1Number().toString();

sp plz help me to solve this problems...
abhishek.s
Freshman
Freshman
 
Posts: 4
Joined: Wed May 26, 2010 2:15 pm

Top

Re: How can I get phone no of device??

Postby JKumar » Wed Jun 02, 2010 8:32 am

HI,

Do you need to access the device number or the phone number(calling number).
Hope the suggestion helps you
Keep posting .It makes us better to understand Android
User avatar
JKumar
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Thu May 13, 2010 8:17 am
Location: INDIA

Re: How can I get phone no of device??

Postby abhishek.s » Thu Jun 03, 2010 9:32 am

I wanted my phone no.(calling no).I tried this codewith indian sim card but didnt work but its works fine in some other countries like US ,Japan , Uk....
so you can use this code to get phone no. .
abhishek.s
Freshman
Freshman
 
Posts: 4
Joined: Wed May 26, 2010 2:15 pm

Re: How can I get phone no of device??

Postby eephyne » Thu Jun 03, 2010 4:34 pm

getLine1Number() Requires Permission: READ_PHONE_STATE , do you set it ?
eephyne
Junior Developer
Junior Developer
 
Posts: 17
Joined: Wed May 26, 2010 10:08 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 20 guests