Is it possible to get all SIM numbers (if dual SIM) from phone programmatically? And how?
I know there's a way to check if the phone is dual sim. But I didn't find information how can I exctract actually those numbers.
There's a method to get phone number but it doesn't work for dual sim:
TelephonyManager tMgr = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
String phone = tMgr.getLine1Number();
It is not possible to get phone number with telephonymanager class because some sim manufacturer companies does not provide sim number on sim card as described in this link. https://stackoverflow.com/a/6797278/6448399
Related
I need to make sure the SIM card can be used without entering pin in designated device(s), but it must be required in other devices. (Devices in use are rooted, application is installed as system app)
What I want is to identify a SIM card, and enter the pin programmatically, if one is already known/saved.
I am able to enter the known pin code, when one is required, but I have a problem with SIM identification.
I found out that I am not able to get SIM serial number or subscriber id before the correct PIN is entered.
The method I am using (with permissions and etc.):
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.getSimSerialNumber();
The thing is, this method returns null, if pin is required and not yet entered.
My question is if there is some kind of workaround for this.
Is it possible at all?
Is there another approach?
Ideas and approaches appreciated.
Thanks in advance.
TelephonyManager tm = (TelephonyManager)
getSystemService(Context.TELEPHONY_SERVICE);
}
String simID = tm.getSimSerialNumber();
String telNumber = tm.getLine1Number();
String IMEI = tm.getDeviceId();
Permission:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Your issue:
The phone number returned is whatever is stored on the SIM card's MSISDN, which is not filled by some operators. Try Airtel, Vodafone if in India.
I used the following code to get to get the sim number and serial number of the sim. But i am getting the sim serial number but not the sim number. I gave the uses permission all the stuffs like that. but i am not getting it.!! Please help me out.!! Thank You.!
TelephonyManager telemamanger = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String getSimSerialNumber = telemamanger.getSimSerialNumber();
String getSimNumber = telemamanger.getLine1Number();
SIM number is not compulsory to be there, it's upto the Telecom if they put number inside the SIM card. It's mostly happen they do it for POSTPAID SIM cards, mostly SIMs do not have number so in that case they return null and if it has, it shall return that NUMBER as it is. To make sure your SIM has number or not, do check that in your android mobile settings.
check this link Check SIM number in android
I am developing an application that requires the IMSI/phone number of the device(with multiple SIM cards) which receives an sms.
This is basically for identification purpose of which SIM is receiving the sms and later perform further operations.
I have thoroughly searched the SMSMessage Api, but did not find a suitable solution.
Any help would be greatly appreciated.
As I know you can not get the destination phone number, IMSI from the incoming SMS.
You can get the IMSI and phone Number of SIM like this way.
You can get the IMSI number of SIM but I don't think you will be able to get the phone number of all SIM because some manufacture did not save the phone number in SIM so you will get the NULL.
In Android, No way using Android SDK to get the second SIM information. You can get the information of first SIM only.
Android SDK support the first SIM information and Dual SIM features are available from manufacture side hence not officially supported from Android SDK.
Add this AndroidManifest.xml
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Add this in where you want to get SIM details.
TelephonyManager telemamanger = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
To get the IMSI of 1st SIM
String imsi = telemamanger.getSimSerialNumber();
To get the Phone Number of 1st SIM
if(telemamanger.getLine1Number() != null)
String phoneNumber = telemamanger.getLine1Number();
I have implemented an application for get the SIM cards mobile numbers from my Google Ebony QWERTY touchscreen.In this device i have two SIM cards.I have used TelephonyManager for get mobile number from device as follows
TelephonyManager tMgr = (TelephonyManager) arTnewActivity.getSystemService(Context.TELEPHONY_SERVICE);
String getSimSerialNumber = tMgr.getLine1Number();
Log.v("Device mobile numbers",getSimSerialNumber);
From the above code it will return a single mobile number but If i run in case of Ebony QWERTY dual sim phone then can i get two sim card serial numbers?
please any body help me..
From what I understand the default SDK does not have support to handle dual sim. From this thread it sounds like you have to ask the manufacturer if they have a special SDK that could provide this.
If it's Google they might have some additional SDK stuffed away somewhere? :-)
I'm trying to retrieve the MSISDN from the SIM using Android, I have tried getLine1Number() but this only returns the MSISDN stored in My Phone Information or Owner Information secction, if these info is not stored, Android will return a null value.
Do you know any work around from this? or is there a way to derive the MSISDN from the SIM number (getSimSerialNumber())?
Awaits a solid Answer as always !!! :)
The MSISDN (aka the mobile phone number) isn't a SIM data, so you can't retrieve it. The SIM card has an IMSI (International Mobile Subsriber Identity) that is sent to the HLR (Home Location Register) in charge of doing the mapping MSISDN/IMSI.
Mobile phone operators could store the MSISDN on the SIM card if they wanted to, but since it is not required in the GSM protocol it isn't.
Sorry!
For more info look at this discussion Getting phone number also How android get MSISDN
EDIT:
To get IMSI number,
TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imsi = mTelephonyMgr.getSubscriberId();
but a few handsets only return 6 digits instead of 15. So, you can use,
According to this post: http://www.anddev.org/tinytut_-_getting_the_imsi_-_imei_sim-device_unique_ids-t446.html
String imei = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMSI);
For more info look at This Question and class SystemProperties