'why getActiveSubscriptionInfoList is getting empty for some android 11 devices?

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


Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Always Learning