0

Is there a way such that the smart phone application will be able to fetch mobile number that is currently active in it. Is it something feasible?

1 Answers1

1

You can use the TelephonyManager to do this:

TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE); 
String number = tm.getLine1Number();

You'll need to give your application permission to make this query by adding the following to your Manifest:

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

(You shouldn't use TelephonyManager.getDefault() to get the TelephonyManager as that is a private undocumented API call and may change in future.)

Ram kiran Pachigolla
  • 20,897
  • 15
  • 57
  • 78