Reputation: 7841
Currently I have developed one application on android 2.3 platform. But when i test it on android 2.2 its not able to retrieve the SIM number or mobile number. Its major requirement in my application. Following is the exact API which fails in Android 2.2
String phoneNumber = telephonyManager.getLine1Number();
in android 2.2 it returns null in android 2.3 it returns the phone number.
Any work around please?
Upvotes: 1
Views: 731
Reputation: 20319
This ins't an API level problem as the TelephonyManager.getLine1Number()
method has been around since API level 1. It probably has to do with the sim cards as not all sim cards provide that information.
I'm guessing you are using devices to test your code and you have one device running 2.2 and another running 2.3, is this correct?
Try swapping the sim cards between the devices and then see which device has the problem with getLine1Number()
I suspect the problem will follow the sim card and not the phone.
Upvotes: 2