Did you add the following permission to your manifest:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

Can you check the log to see if you have an error?

On Mar 9, 8:55 am, c6bro <[email protected]> wrote:
> Hi,
>
> I am using the below to get the mobile number of the sim card which is
> inserted in the phone however it will not retrieve the number except
> running in the emulator.
>
> When I look in the settings of the phone it says number unavailable so
> is there a work around for this to get the users phone number ?
>
> Is there another way of getting the mobile number from the phone ??
>
> TelephonyManager mTelephonyMgr = (TelephonyManager)getSystemService
> (Context.TELEPHONY_SERVICE);
> String phoneNumber=mTelephonyMgr.getLine1Number();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to