Glory to Russia
Glory to Russia

Reputation: 18760

How to find out phone number of a sim given its IMEI number?

I have a dual sim Android phone. Using this solution I retrieve IMEI numbers of both sims.

Given the IMEI number, how can I find out the phone number of each sim?

There are methods getDeviceIdGemini(int slotId) and getSimStateGemini(int slotId) it is possible to find out the IMEI number and the state of each sims.

I'm looking for a similar method for reading the phone number of the sim.

Upvotes: 2

Views: 16596

Answers (4)

Glory to Russia
Glory to Russia

Reputation: 18760

Using reflection, I looked at the methods of TelephonyManager and found this method: int getLine1NumberGemini(int).

I tried to invoke it (getLine1NumberGemini(0) for first sim and getLine1NumberGemini(1) for the second). In both cases I received an empty string.

But the reason for this seems to be the inability of the phone to get the phone number of my sims:

  1. TelephonyManager.getLine1Number() returns empty string as well.
  2. When I open "Sim management" in the settings of the phone, no phone numbers are displayed.

Upvotes: 1

NetStarter
NetStarter

Reputation: 3225

No,

Android doesn't support dual sim devices.

See: Detect the status of two SIM cards in a dual-SIM Android phone

as Android does not support multiple SIMs, at least from the SDK.

You can contact your device manufacturer and see if they have an SDK add-on or something that allows you to access the second SIM.May be an API which can help youto get your desired result.

Although you can find out the status of the device whether it is Dual sim or not by using this link Android : Check whether the phone is dual SIM

Upvotes: 1

Gabe Sechan
Gabe Sechan

Reputation: 93728

Programmatically obtain the phone number of the Android phone

Basic answer- there is no way to get your current phone number. There's things that sometimes work, but not always and not on all carriers.

Upvotes: 2

Buda Gavril
Buda Gavril

Reputation: 21657

You can't. Phone number it's not stored on sim card, it's stored on operator's servers. Look for TelephonyManager.getSubscriberId(), this will give the unique id for each SIM.

Upvotes: 2

Related Questions