java - How to get phone number of the device in android activity -


is there way phone number of device, using googleapiclient. got email, want phone number.

add permission:

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

and later use this:

telephonymanager t = (telephonymanager)mappcontext.getsystemservice(context.telephony_service); string mphonenumber = t.getline1number(); 

note: method - although 1 of ways - not reliable. can return false number, blank string, or null.


Comments