sim serial number vs imsi - android

I am building an android app that will be licensed on the user's SIM card. There are 2 possible values that I can check against:
SIM SERIAL NUMBER: TelephonyManager.getSimSerialNumber();
IMSI: TelephonyManager.getSubscriberId();
As I do not want to use both, I guess that there is no actually difference to rely to the one or to the other. Am I right or is there something that I am missing here?
Thanks!

It depends on what you want.
If the license works by checking that the serial number matches your database as an example.
If the user installs your app and the sim card serial is stored in your DB, if the user removes the sim card and inserts a new sim card, the license will fail as your DB doesn't store the serial for the new sim card.
If you get based on the IMSI number then the license will be with the device, so even if user replaces the SIM the license will still pass as your using the device ID.
Note though I don't know whether the SIM serial will work or how it will handle devices that do not have SIM such as CDMA devices in the US.

ICCID (SIM Serial) is the serial number of the SIM. It is unique per SIM.
IMSI is a SubsID. It is actually a network ID.
More reference: https://m.blog.naver.com/framkang/220363349346

Related

Question related to hardware, arduino etc

Is there any possibility to get the number from the mobile sim card using any sensor ???
For example, if a person have a mobile phone in her hand and when the person pass from the gate we want to get the number of that sim card whose in her mobile phone!
Not possible!! You cannot get the number directly from the Simcard chip.
The encrypted data and some other data!
https://www.elprocus.com/how-sim-card-works/
You can read the above article to be more clear!
No. Telephone number isn't stored on a sensor, it is obtained from the network, and if you want to make it available to your application you will need to have obtained permission to the telephony service, and you can then access it through a TelephonyManager object.

Android Telephony - dual SIM versus single SIM with multiple IMSI

Mobile handsets can have dual SIMs, where each SIM (usually) has a single IMSI. However it is possible for a SIM card to have dual IMSI as well, and in fact IMSI that can be "configured on it" on-the-fly by operator. The latter mechanism is used for roaming scenarios, such as for business customers, where one (fixed) IMSI will be used by your home-country operator's phone number, and the other (flexible) IMSI that could be configured to visited-country operator's phone number (with whom your operator has a specific roaming arrangement). This way people can call you on either number, and you do not have to swap SIMs. Note that this was possible even before dual-SIM phones became relatively common.
For multi-SIM, I found some answers such as this one where one answer suggests using MultiSIM API (from 3rd party), and another answer suggests using the official supported API available since Android 5.1 (API level >22) or the unsupported TelephonyManager way from this answer (which I presume works for older API levels as well). However, it is not evident if those API's work for single SIM multi IMSI as well.
Unfortunately, I am yet to lay my hands on dual-IMSI SIM card to try this out. While I am trying to procure one, can anyone who has tried confirm or share findings ?
I'm not exactly sure what the question is, however a single SIM will only ever have one active imsi. Yes SIM cards can can multiple imsi's and an operator can update the imsi. However a SIM will only have ONE active IMSI.
A SIM can only have one active IMSI due to the SIM specification which says a IMSI must be stored in file ID:
3F00 (MF) -> 7F20 -> (DF_GSM) -> 6F07 (EF_IMSI).
A device (phone/modem) will request the IMSI from this file and only this file. if they were two "active" IMSI's no device currently would know where to find that IMSI without a firmware change.

Android How to get Phone number from the Dual sim phone

Hello friends in my app i want to show user to their sim phone number but with in dual sim mobile is not give any type number i much googling but not get exact.please help meto get phone number from dual sim.
Note following is not working on dual sim to get number:
String phonenumber = telephonymanager.getLine1Number();
telephonymanager.getLine1Number() does not guarantee to return the Sim number, as the phone number is not physically stored on all Sim cards.
A better alternative is to ask the user for the phone number once, and confirm the same by sending a message to that number.
Here is a better explanation for the same.

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.
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.
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.
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
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:
TelephonyManager.getLine1Number() returns empty string as well.
When I open "Sim management" in the settings of the phone, no phone numbers are displayed.

Getting the TMSI from the SIM card

Is it possible, in Android or any other mobile OS, to access the encrypted information passed from the SIM card to the cellular network? I mean the mobile signature, or the TMSI number. I need this data after it is encripted by the sim. I mean the IMSI after it is encrypted by the SIM to be sent to the network.
Thanks :)
Impossible. Android so far does not provide any direct API's and/or other interfaces to SIM card, except for some basic information like country code, operator name, etc, which is kindly provided by TelephonyManager.
Additionally, SIM interface normally is connected to modem CPU, not application one, thus eliminating any possible hacks/workarounds.
As I know SIM doesn't encrypt the IMSI information,that's the one reason to use TMSI.
Exactly, SIM doesn't do that. Its all done using Hardware of phone. And TMSI don't have anything to do with phone. It is used in radio interfaces just to secure user information and confidentiality. Phone will be always identified by IMSI not TMSI.
Basically they uses some key values. And those keys do the twist. Algorithm A5 and A8 are used for key purpose.
Pankaj Singh

Categories

Resources