I need to find out device SIM card is present or not(including duel sim devices). So that I have tried Subscription Manager getActiveSubscriptionInfoList API, but it is returning empty for certain android 11 devices.
Information:
- Slot 1 has a SIM card
- Slot 2 don't have SIM card
- Device OS version: Android 11
- Device Model Name: RMX3085realme
- Network Provider Jio Prepaid
SubscriptionManager#getActiveSubscriptionInfoList()
returns the subscription list that is provisioned by a carrier application. If no carrier app has successfully notified Android to an available subscription, then this will return empty irregardless of whether there is a sim card or not.TelephonyManager#getSimState()
(link) is what you want to use if you only want to check if a sim card is present or not as you have stated. As long asTelephonyManager#getSimState()
does not returnSIM_STATE_ABSENT
(link), that would signify a sim card is present.