-3

In my app i want to show the both inserted sim card mobile number to user in android studio . But i suffer from problem in which , i stuck at getting of second inserted sim mobile number . Help me to solve this.

user13301557
  • 11
  • 1
  • 2
  • 1
    look here: https://stackoverflow.com/questions/2480288/programmatically-obtain-the-phone-number-of-the-android-phone – Brokkoli 71 Apr 13 '20 at 12:31
  • 2
    Does this answer your question? [Programmatically obtain the phone number of the Android phone](https://stackoverflow.com/questions/2480288/programmatically-obtain-the-phone-number-of-the-android-phone) – dawis11 Apr 13 '20 at 12:32

1 Answers1

-1

TelephonyManager - "Provides access to information about the telephony services on the device. Applications can use the methods in this class to determine telephony services and states, as well as to access some types of subscriber information."

Code:

TelephonyManager telephonyManager =(TelephonyManager)getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
//SIM 1 Number
String mSimPhoneNumber1 = telephonyManager.getLine1Number();
//SIM 2 Number
String mSimPhoneNumber2 = telephonyManager.getLine2Number();

This method might returns a null on some phones.

Required Permission:

<uses-permission android:name="android.permission.READ_PHONE_STATE"/> 
Hayssam Soussi
  • 903
  • 7
  • 16