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

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -