9

What does getLine1Number() method of TelephonyManager return with dual SIM phones like LG Optimus Net Dual?

Gaurav Agarwal
  • 18,754
  • 29
  • 105
  • 166
  • I would have to yet test it but I think it would return the primary SIM number. – Raykud Jun 25 '12 at 23:22
  • @Raykud Looking forward to your reply. – Gaurav Agarwal Jun 27 '12 at 11:12
  • well it looks that one SIM card is in stand-by mode and the other is not and set as primary, therefore it will return the number of the sim that is not in stand-by mode. – Raykud Jun 27 '12 at 15:42
  • There are two kinds of phone, first with one active and second stand-by SIM and second with both active SIM and if you would have clickek the link you would have known `LG Optimus Net Dual` and phone with both SIM(s) active – Gaurav Agarwal Jun 27 '12 at 19:44
  • the link does not mention that both SIM are active. – Raykud Jun 27 '12 at 20:21

3 Answers3

11

You'll get back only one number ... maybe!

First, which number you get back is device dependent.

But equally importantly whether you will get a number at all, and whether this number will be the phone number, is completely unpredictable. This is SIM and operator dependent.

In one of my apps, I started off trying to use the phone number as a unique ID, since I could expect the user to recall this number easily. For most operators in Asia, Australia and some in Europe, the phone number (line1number()) is simply not stored on the SIM! With others, you may get a string of zeroes. Or a number formatted in a way that may make sense locally but could mess up your app's logic.

PVS
  • 1,168
  • 11
  • 24
2

Android doesn't support dual sim devices. See: Detect the status of two SIM cards in a dual-SIM Android phone

As someone else said you might get support from device manufacturers.

Additionally getLine1Number() isn't guaranteed to return a phone number. It just returns what the operators store in the card, and some operators don't bother filling in that number. So with some sim cards this would just return null.

If you provide details of what you are trying to achieve we might be able to provide a better solution.

Community
  • 1
  • 1
chkdsk
  • 1,187
  • 6
  • 20
0

The default SDK does not have support to handle dual SIM phones. The function will only return one number, most likely from the first active SIM card.

However, manufacturer sometimes give out SDKs for handling these things, you might want to have a look at this.

Force
  • 6,312
  • 7
  • 54
  • 85
  • 1
    @gonzobrains i know it's up to manufacturer, but i asked if anyone knows about such manufacturers. – Kishore May 14 '13 at 09:17