Simeoni Peraparota
Simeoni Peraparota

Reputation: 299

what is the USSD to get mobile number

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

Answers (1)

Gabe Sechan
Gabe Sechan

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

Related Questions