Example usage for android.telecom PhoneAccount CAPABILITY_SIM_SUBSCRIPTION

List of usage examples for android.telecom PhoneAccount CAPABILITY_SIM_SUBSCRIPTION

Introduction

In this page you can find the example usage for android.telecom PhoneAccount CAPABILITY_SIM_SUBSCRIPTION.

Prototype

int CAPABILITY_SIM_SUBSCRIPTION

To view the source code for android.telecom PhoneAccount CAPABILITY_SIM_SUBSCRIPTION.

Click Source Link

Document

Flag indicating that this PhoneAccount represents a built-in PSTN SIM subscription.

Usage

From source file:Main.java

/**
 * Return a list of phone accounts that are subscription/SIM accounts.
 *//*from w w w  .  j  a va 2  s .c om*/
public static List<PhoneAccountHandle> getSubscriptionPhoneAccounts(Context context) {
    final TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);

    List<PhoneAccountHandle> subscriptionAccountHandles = new ArrayList<PhoneAccountHandle>();
    List<PhoneAccountHandle> accountHandles = telecomManager.getCallCapablePhoneAccounts();
    for (PhoneAccountHandle accountHandle : accountHandles) {
        PhoneAccount account = telecomManager.getPhoneAccount(accountHandle);
        if (account.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)) {
            subscriptionAccountHandles.add(accountHandle);
        }
    }
    return subscriptionAccountHandles;
}