EuiccManager.SwitchToSubscription Method

Definition

Overloads

SwitchToSubscription(Int32, PendingIntent)

Switch to (enable) the given subscription.

SwitchToSubscription(Int32, Int32, PendingIntent)

Switch to (enable) the given subscription.

SwitchToSubscription(Int32, PendingIntent)

Switch to (enable) the given subscription.

[Android.Runtime.Register("switchToSubscription", "(ILandroid/app/PendingIntent;)V", "GetSwitchToSubscription_ILandroid_app_PendingIntent_Handler", ApiSince=28)]
[Android.Runtime.RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS")]
public virtual void SwitchToSubscription (int subscriptionId, Android.App.PendingIntent? callbackIntent);
[<Android.Runtime.Register("switchToSubscription", "(ILandroid/app/PendingIntent;)V", "GetSwitchToSubscription_ILandroid_app_PendingIntent_Handler", ApiSince=28)>]
[<Android.Runtime.RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS")>]
abstract member SwitchToSubscription : int * Android.App.PendingIntent -> unit
override this.SwitchToSubscription : int * Android.App.PendingIntent -> unit

Parameters

subscriptionId
Int32

the ID of the subscription to enable. May be android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID to deactivate the current profile without activating another profile to replace it. Calling apps targeting on android T must use #switchToSubscription(int, int, PendingIntent) API for disable profile, port index can be found from SubscriptionInfo#getPortIndex(). If it's a disable operation, requires the android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS permission, or the calling app must be authorized to manage the active subscription on the target eUICC.

callbackIntent
PendingIntent

a PendingIntent to launch when the operation completes.

Attributes

Remarks

Switch to (enable) the given subscription.

Requires the android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS permission, or the calling app must be authorized to manage both the currently-active subscription and the subscription to be enabled according to the subscription metadata. Without the former, an #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR will be returned in the callback intent to prompt the user to accept the download.

On a multi-active SIM device, requires the android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS permission, or a calling app only if the targeted eUICC does not currently have an active subscription or the calling app is authorized to manage the active subscription on the target eUICC, and the calling app is authorized to manage any active subscription on any SIM. Without it, an #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR will be returned in the callback intent to prompt the user to accept the download. The caller should also be authorized to manage the subscription to be enabled.

From Android T, devices might support PackageManager#FEATURE_TELEPHONY_EUICC_MEP, the subscription can be installed on different port from the eUICC. Calling apps with carrier privilege (see TelephonyManager#hasCarrierPrivileges) over the currently active subscriptions can use #switchToSubscription(int, int, PendingIntent) to specify which port to enable the subscription. Otherwise, use this API to enable the subscription on the eUICC and the platform will internally resolve a port based on following rules: <ul> <li>always use the default port 0 is eUICC does not support MEP or the apps are not targeting on Android T. <li>In SS(Single SIM) mode, if the embedded slot already has an active port, then enable the subscription on this port. <li>In SS mode, if the embedded slot is not active, then try to enable the subscription on the default port 0 of eUICC. <li>In DSDS mode, find first available port to enable the subscription. (see #isSimPortAvailable(int)) </ul> If there is no available port, an #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR will be returned in the callback intent to prompt the user to disable an already-active subscription.

Java documentation for android.telephony.euicc.EuiccManager.switchToSubscription(int, android.app.PendingIntent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SwitchToSubscription(Int32, Int32, PendingIntent)

Switch to (enable) the given subscription.

[Android.Runtime.Register("switchToSubscription", "(IILandroid/app/PendingIntent;)V", "GetSwitchToSubscription_IILandroid_app_PendingIntent_Handler", ApiSince=33)]
[Android.Runtime.RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS")]
public virtual void SwitchToSubscription (int subscriptionId, int portIndex, Android.App.PendingIntent callbackIntent);
[<Android.Runtime.Register("switchToSubscription", "(IILandroid/app/PendingIntent;)V", "GetSwitchToSubscription_IILandroid_app_PendingIntent_Handler", ApiSince=33)>]
[<Android.Runtime.RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS")>]
abstract member SwitchToSubscription : int * int * Android.App.PendingIntent -> unit
override this.SwitchToSubscription : int * int * Android.App.PendingIntent -> unit

Parameters

subscriptionId
Int32

the ID of the subscription to enable. May be android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID to deactivate the current profile without activating another profile to replace it. If it's a disable operation, requires the android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS permission, or the calling app must be authorized to manage the active subscription on the target eUICC. From Android T, multiple enabled profiles is supported. Calling apps targeting on android T must use #switchToSubscription(int, int, PendingIntent) API for disable profile, port index can be found from SubscriptionInfo#getPortIndex().

portIndex
Int32

the index of the port to target for the enabled subscription

callbackIntent
PendingIntent

a PendingIntent to launch when the operation completes.

Attributes

Remarks

Switch to (enable) the given subscription.

Requires the android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS permission, or the caller must be having both the carrier privileges (see TelephonyManager#hasCarrierPrivileges) over any currently active subscriptions and the subscription to be enabled according to the subscription metadata. Without the former permissions, an SecurityException is thrown.

If the caller is passing invalid port index, an #EMBEDDED_SUBSCRIPTION_RESULT_ERROR with detailed error code #ERROR_INVALID_PORT will be returned. The port index is invalid if one of the following requirements is met: <ul> <li>index is beyond the range of UiccCardInfo#getPorts(). <li>In SS(Single SIM) mode, the embedded slot already has an active port with different port index. <li>In DSDS mode, if the psim slot is active and the embedded slot already has an active empty port with different port index. </ul>

Depending on the target port and permission check, an #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR might be returned to the callback intent to prompt the user to authorize before the switch.

Java documentation for android.telephony.euicc.EuiccManager.switchToSubscription(int, int, android.app.PendingIntent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to