Is there any way to get phone number of device, by using GoogleApiClient. I got email, now want phone number.
Asked
Active
Viewed 1.0k times
2
-
2No, not possible using GoogleApiClient. There is one way you can do it, but it's flaky and doesn't always work, see here: [Programmatically obtain the phone number of the Android phone](http://stackoverflow.com/questions/2480288/programmatically-obtain-the-phone-number-of-the-android-phone) – Daniel Nugent Feb 03 '16 at 02:21
1 Answers
2
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
.

Abdul Wasae
- 3,614
- 4
- 34
- 56

josedlujan
- 5,357
- 2
- 27
- 49