Reputation: 299
i have an android application which requires to get the mobile number. i tried this
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String number = tm.getLine1Number();
but it returns null, after I read the documentation of the TelephoneManager
I understood that some phones don't have the mobile number they are working on.
the solution was to send an USSD code to get it.
I couldn't find that, any help please?
Upvotes: 0
Views: 1063
Reputation: 93668
USSD isn't really supported in Android. But even if you can get it to work, USSD codes vary by carrier
Upvotes: 2