How to get phone number of the device in android activity

Is there any way to get phone number of device, by using GoogleApiClient. I got email, now want phone number.


Add this 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: This method - although one of the only ways to do it - is not reliable. It can return a false number, blank string, or even null.

Need Your Help

Coustomize Orangehrm Login Process

php smarty autologin orangehrm

I want to coustomize Orangehrm. This includes a simple change in the login process. I want to get auto login into the Orangehrm when I login into my own website build using smarty. Can anybody tell...

Implementing sampling & data mining algorithms in Hadoop

java algorithm hadoop data-mining sampling

The current implementation involves sampling of large input transactional file and then finally applying the 'FP growth algorithm' to this sampled data for data mining. However, it has its limitati...