telephonymanager works in emulator but not in phone
I would like to get the phone number with android.
I did:
TelephonyManager tMgr
=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
String phoneNumber = tMgr.getLine1Number();
phoneNumberT = (TextView)findViewById(R.id.phone);
phoneNumberT.setText("Number: " + phoneNumber);
and in Android Manifest:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
with the emulator i see this:
Number: 15555215554
But I installed the app in my android phone I only see
Number:
Why is not shown in the number?
No comments:
Post a Comment