Problem with SIM card status detection on LG-P500

My application must check the status of the SIM card before performing the action. So for this I use TelephonyManager.getSimState (). If the application looks like SIM_STATE_READY, then it continues differently, showing an error to the user. This works fine so far, but lately I have received complaints from owners of LG-P500 devices (LG Optimus One), stating that although the user has a SIM card inserted in the device and capable of making / receiving calls, my application continues to give SIM error.

Logs from the user show that on the device I get the sim status as SIM_STATE_UNKNOWN (0).

OS Version :2.3.3 Brand :lge Device :thunderg 

Is LG somehow controlling the status of Sim otherwise or is LG somehow considering SIM_STATE_UNKNOWN and SIM_STATE_READY the same?

Thanks,

Tushar

+4
source share
2 answers

I have the same problem only with LG P500 with 2.3, it works fine on 2.2. To determine if the SIM is ready, you can use

`TelephonyManager tm = (TelephonyManager) context.getSystemService (Context.TELEPHONY_SERVICE);

String imsi = tm.getSubscriberId (); `

If imsi is not null, the SIM card is ready.

The PhoneStateListener also runs on the LG P500, and you can use it.

+3
source

Doc says

public static final int SIM_STATE_UNKNOWN

SIM Card Status: Unknown. Indicates that the SIM card is in the process of transition between states. For example, when a user enters a SIM card PIN into PIN_REQUIRED Status, a sim status request returns this status before switching to SIM_STATE_READY.

SIM_STATE_READY is not equal to SIM_STATE_UNKNOW

The reason for showing unknowns can be many. In addition, it is likely that it is on a CDMA network, therefore, it may not have a SIM card or access to it.

0
source

Source: https://habr.com/ru/post/1380563/


All Articles