why getActiveSubscriptionInfoList is getting empty for some android 11 devices?

1.8k views Asked by At

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
1

There are 1 answers

7
Always Learning On

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 as TelephonyManager#getSimState() does not return SIM_STATE_ABSENT(link), that would signify a sim card is present.