0

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?

1 Answers1

2

USSD isn't really supported in Android. But even if you can get it to work, USSD codes vary by carrier

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • so lets forget about android, I just wants to know the USSD, you said it is vary by networks, right? so i have to ask the network provider to tell me right? is this against privacy please? – Simeoni Peraparota Jun 14 '13 at 19:36