What does getLine1Number()
method of TelephonyManager
return with dual SIM phones like LG Optimus Net Dual
?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With