You need the permission READ_PHONE_STATE, then use
TelephonyManager.getDefault() to get hold of the TelephonyManager. On
the returned instance call mgr.getLine1Number() and there it is :)
Cheers
-Huebi
On 19 Aug., 07:30, j [EMAIL PROTECTED] wrote:
How do I get the user's phone number in 0.9
Do not use TelephonyManager.getDefault(), this is private API that may
change. Instead use the following:
(TelephonyManager) getSystemService(phone)
On Mon, Aug 18, 2008 at 11:06 PM, Huebi [EMAIL PROTECTED] wrote:
You need the permission READ_PHONE_STATE, then use
You should get the TelephonyManger using
getSystemService(TELEPHONY_SERVICE) instead, like this:
TelephonyManager telephony = (TelephonyManager)
getSystemService(TELEPHONY_SERVICE);
See
http://code.google.com/android/reference/android/content/Context.html#TELEPHONY_SERVICE
for the definition
3 matches
Mail list logo