I am trying to get the phone number of the current phone, and I've used this code (I already have permissions in the manifest):
TelephonyManager mTelephonyMgr;
mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String phoneNumber = mTelephonyMgr.getLine1Number();
I tried this code in the android emulator and it works fine and gives me a number (I guess it's the emulator's phone number),
However when I tried this code on my phone(galaxy s2) it returned an empty string.
Thanks