Reputation: 21
TelephonyManager mt=(TelephonyManager)this.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
ph=mt.getLine1Number();
String serial=mt.getSimSerialNumber();
if(ph.equals(null)){
txt.setText("serial number is: "+serial );}
else
txt.setText("phone Number is "+ph);
in my android manifest file
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
This is my code. And my output is like this phone number is
it wouldn't display my phone number. why so?
Upvotes: 1
Views: 333