Check SIM PIN with SDK Android - android

My app needs to check the pin inserted by a user with the SIM card pin and that Android has to answer me if the pin inserted is correct. I only need to check, never change the code pin.
It is possible?

Not sure if it can be done, but:
I would not rely on a SIM card being present - think of tablets with WiFi only.
Also as a user I would not trust any application that would ask for the pin of my SIM card.

Related

How instagram app knows my device location without internet, gps, sim card

If your answer is TimeZone,TelephonyManager,Locale,ip adress/http request please elaborate properly.
1. Uninstall instagram app on your device then install it again. Before opening instagram app turn off your internet for more clarity you can turn on airplane mode/aeroplane mode/flight mode. Now open instagram app. Click on create account. Now you can see your country name and code in phone number edit box. From this we concluded that instagram doesn't use ip adress/http request as there is no internet available.
2. No need to explain about TimeZone,TelephonyManager,Locale. As we know these are not working at certain conditions.
Assuming you gave it location permission, it doesn't need any of that. It doesn't need a working internet connection, it can get cellular location just by pining what towers are nearby, which doesn't need a working SIM, it just needs to be able to detect a signal. Same for wifi- you don't need to be on a wifi network, you just need to be able to detect wifi signals.
Of course for something as vague as country name and code there's a dozen possible answers. Locale is the most likely- if your language is set to en_us, it uses 1 and USA. If its fr_fr, it uses the french country code. Etc.

How long does a Subscription ID stick around in Android?

Starting on API Level 22, there is native support in Android for Dual-SIM devices. At the center of the APIs, there is SubscriptionInfo.getSubscriptionId().
Using these IDs, you can retrieve SmsManagers for each respective SIM card to send SMS and MMS. You can also identify through which SIM card an SMS was received on the SMS_RECEIVED_ACTION, and so on.
However, what is the lifetime of a Subscription ID? Can I store a Subscription ID in a local database and count on it to still be valid and pointing to the same SIM card later? By later, I mean after rebooting the device, removing its SIM card and popping it back in, or even after factory resetting the device.
I tested the resilience of SubscriptionId myself, using two SIM cards, though on a Single-SIM device, since that is what I had available at the time.
First, I noted the SubscriptionId the system was giving me when SIM Card A was inserted. The SubscriptionId I was getting had a value of 2.
Next, I restarted the device. The SubscriptionId after restart was still 2.
Then, I turned off the device, removed SIM Card A and put in SIM Card B. After turning the device back on, the SubscriptionId changed to 4.
Lastly, I turned the device back off, removed SIM Card B and put SIM Card A back in. After turning the device back on, the SubscriptionId changed back to 2.
In conclusion, it looks like Android assigns a SubscriptionId unique to each SIM Card. The SubscriptionId seems to survive system reboots, and SIM Card removal and reinsertion. I did not test factory resets, but my gut feeling is that it probably will not survive those, since the system would not have any history of interaction with a SIM Card after a factory reset.

How to detect which sim card is in use

I am new to android and am making an app to send messages programmatic-ally . Since, I couldn't find a way to detect which SIM is used to send an SMS or that Dual SIM wasn't supported or applicable, my question is:
Is there a way to block a SIM Card in one's android phone? By "block" I mean, SIM_STATUS is returned to false by some means without actually removing the SIM from the SIM slot? Like, it stays there but is not ready to be used. Also, can i do the opposite?
And all this programmatic-ally without doing anything to the phone on manual basis.
By default android does not supported dual SIM. but
if u set default SIM for sms from android setting . your application will always send SMS from your default SIM

Checking the possibility to make a call

I'd to check whether it's possible to make a normal call (not only emergency call) and if it is then get the number of a sim card by what it is possible to do (including the case when it is a dual sim card - get the active number). And I also want to check whether or not the phone is in roaming. So overall there might be 3 cases:
It is not possible to make a normal call - the phone is in roaming and there is no operator which supports its "home" operator or the phone is just unavailable due to its location (in a subway, for example).
It is possible to make a call and the phone is in roaming
It is possible to make a call and the phone is not in roaming, it is in its home country.
Is this all possible and if yes then how? The general instructions are ok.
Take a look at TelephonyManager.
There are methods to check whether you are roaming,cell info and more data.
You can use this information to achieve what you are trying to do.

How to capture event of removal of SIM card in android?

In android, how do I capture the event of SIM card removal? Usually on phones like htc 1x, we can remove the SIM card without removing the battery and there is no notification as such of power off or restart of the phone. I want to capture the event of SIM card removal, so that I can pop-up some messages.
Check answer number one, You can check whether the sim card is available or not in device by using TelephonyManager class.
How can I check whether the Sim Card is available in an android device?
According to this answer, the system sends out an android.intent.action.SIM_STATE_CHANGED intent when the SIM card when the SIM card changes, for example when entering or leaving airplane mode, and presumably also when removing or inserting a SIM card.
It should be noted that as this is an undocumented API that may change without notice, and it may also not be available on some devices.
As for shutting down or restarting, according to this answer, the system sends out an android.intent.action.ACTION_SHUTDOWN intent (on Android 1.6 or later).

Categories

Resources