EuiccManager
public
class
EuiccManager
extends Object
java.lang.Object | |
↳ | android.telephony.euicc.EuiccManager |
EuiccManager is the application interface to eUICCs, or eSIMs/embedded SIMs.
You do not instantiate this class directly; instead, you retrieve an instance through
Context#getSystemService(String)
and Context#EUICC_SERVICE
. This instance will be
created using the default eUICC.
On a device with multiple eUICCs, you may want to create multiple EuiccManagers. To do this
you can call createForCardId(int)
.
See isEnabled()
before attempting to use these APIs.
Requires the PackageManager#FEATURE_TELEPHONY_EUICC
feature which can be detected using PackageManager.hasSystemFeature(String)
.
Summary
Constants | |
---|---|
String |
ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS
Intent action to launch the embedded SIM (eUICC) management settings screen. |
String |
ACTION_NOTIFY_CARRIER_SETUP_INCOMPLETE
Broadcast Action: The action sent to carrier app so it knows the carrier setup is not completed. |
String |
ACTION_START_EUICC_ACTIVATION
Intent action sent by a carrier app to launch the eSIM activation flow provided by the LPA UI (LUI). |
int |
EMBEDDED_SUBSCRIPTION_RESULT_ERROR
Result code for an operation indicating that an unresolvable error occurred. |
int |
EMBEDDED_SUBSCRIPTION_RESULT_OK
Result code for an operation indicating that the operation succeeded. |
int |
EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR
Result code for an operation indicating that the user must take some action before the operation can continue. |
int |
ERROR_ADDRESS_MISSING
Address is missing e.g SMDS/SMDP address is missing. |
int |
ERROR_CARRIER_LOCKED
Operation such as downloading/switching to another profile failed due to device being carrier locked. |
int |
ERROR_CERTIFICATE_ERROR
Certificate needed for authentication is not valid or missing. |
int |
ERROR_CONNECTION_ERROR
Failure to create a connection. |
int |
ERROR_DISALLOWED_BY_PPR
Failed to load profile onto eUICC due to Profile Policy Rules. |
int |
ERROR_EUICC_INSUFFICIENT_MEMORY
There is no more space available on the eUICC for new profiles. |
int |
ERROR_EUICC_MISSING
eUICC is missing or defective on the device. |
int |
ERROR_INCOMPATIBLE_CARRIER
The profile's carrier is incompatible with the LPA. |
int |
ERROR_INSTALL_PROFILE
Failure to load the profile onto the eUICC card. |
int |
ERROR_INVALID_ACTIVATION_CODE
The activation code(SGP.22 v2.2 section[4.1]) is invalid. |
int |
ERROR_INVALID_CONFIRMATION_CODE
The confirmation code(SGP.22 v2.2 section[4.7]) is invalid. |
int |
ERROR_INVALID_PORT
Failure due to target port is not supported. |
int |
ERROR_INVALID_RESPONSE
Response format is invalid. |
int |
ERROR_NO_PROFILES_AVAILABLE
No profiles available. |
int |
ERROR_OPERATION_BUSY
The operation is currently busy, try again later. |
int |
ERROR_SIM_MISSING
No SIM card is available in the device. |
int |
ERROR_TIME_OUT
Timed out while waiting for an operation to complete. |
int |
ERROR_UNSUPPORTED_VERSION
The eUICC card(hardware) version is incompatible with the software |
long |
EUICC_MEMORY_FIELD_UNAVAILABLE
Temporary failure to retrieve available memory because eUICC is not ready. |
String |
EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE
Key for an extra set on |
String |
EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION
Key for an extra set on |
String |
EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE
Key for an extra set on |
String |
EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE
Key for an extra set on |
String |
EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE
Key for an extra set on |
String |
EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE
Key for an extra set on |
String |
EXTRA_USE_QR_SCANNER
Key for an extra set on actions |
String |
META_DATA_CARRIER_ICON
Optional meta-data attribute for a carrier app providing an icon to use to represent the carrier. |
int |
OPERATION_APDU
The exception of failing to execute an APDU command. |
int |
OPERATION_DOWNLOAD
Download profile error. |
int |
OPERATION_EUICC_CARD
eUICC card error. |
int |
OPERATION_EUICC_GSMA
eUICC returned an error defined in GSMA (SGP.22 v2.2) while running one of the ES10x functions. |
int |
OPERATION_HTTP
HTTP error |
int |
OPERATION_METADATA
Subscription's metadata error |
int |
OPERATION_SIM_SLOT
SIM slot error. |
int |
OPERATION_SMDX
SMDX(SMDP/SMDS) error |
int |
OPERATION_SMDX_SUBJECT_REASON_CODE
SubjectCode[5.2.6.1] and ReasonCode[5.2.6.2] error from GSMA (SGP.22 v2.2)
When |
int |
OPERATION_SWITCH
Generic switching profile error |
int |
OPERATION_SYSTEM
Internal system error. |
Public methods | |
---|---|
EuiccManager
|
createForCardId(int cardId)
Create a new EuiccManager object pinned to the given card ID. |
void
|
deleteSubscription(int subscriptionId, PendingIntent callbackIntent)
Deletes the given subscription. |
void
|
downloadSubscription(DownloadableSubscription subscription, boolean switchAfterDownload, PendingIntent callbackIntent)
Attempt to download the given |
long
|
getAvailableMemoryInBytes()
Returns the available memory in bytes of the eUICC. |
String
|
getEid()
Returns the EID identifying the eUICC hardware. |
EuiccInfo
|
getEuiccInfo()
Returns information about the eUICC chip/device. |
boolean
|
isEnabled()
Whether embedded subscriptions are currently enabled. |
boolean
|
isSimPortAvailable(int portIndex)
Returns whether the passing portIndex is available. |
void
|
startResolutionActivity(Activity activity, int requestCode, Intent resultIntent, PendingIntent callbackIntent)
Start an activity to resolve a user-resolvable error. |
void
|
switchToSubscription(int subscriptionId, PendingIntent callbackIntent)
Switch to (enable) the given subscription. |
void
|
switchToSubscription(int subscriptionId, int portIndex, PendingIntent callbackIntent)
Switch to (enable) the given subscription. |
void
|
updateSubscriptionNickname(int subscriptionId, String nickname, PendingIntent callbackIntent)
Update the nickname for the given subscription. |
Inherited methods | |
---|---|
Constants
ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS
public static final String ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS
Intent action to launch the embedded SIM (eUICC) management settings screen.
This screen shows a list of embedded profiles and offers the user the ability to switch between them, download new profiles, and delete unused profiles.
The activity will immediately finish with Activity.RESULT_CANCELED
if
isEnabled()
is false.
This is ued by non-LPA app to bring up LUI.
Constant Value: "android.telephony.euicc.action.MANAGE_EMBEDDED_SUBSCRIPTIONS"
ACTION_NOTIFY_CARRIER_SETUP_INCOMPLETE
public static final String ACTION_NOTIFY_CARRIER_SETUP_INCOMPLETE
Broadcast Action: The action sent to carrier app so it knows the carrier setup is not completed.
Constant Value: "android.telephony.euicc.action.NOTIFY_CARRIER_SETUP_INCOMPLETE"
ACTION_START_EUICC_ACTIVATION
public static final String ACTION_START_EUICC_ACTIVATION
Intent action sent by a carrier app to launch the eSIM activation flow provided by the LPA UI (LUI). The carrier app must send this intent with one of the following:
EXTRA_USE_QR_SCANNER
not set or set to false: The LPA should try to get an
activation code from the carrier app by binding to the carrier app service implementing
android.service.euicc.EuiccService#ACTION_BIND_CARRIER_PROVISIONING_SERVICE
.
EXTRA_USE_QR_SCANNER
set to true: The LPA should launch a QR scanner for the user
to scan an eSIM profile QR code.
Upon completion, the LPA should return one of the following results to the carrier app:
Activity.RESULT_OK
: The LPA has succeeded in downloading the new eSIM profile.
Activity.RESULT_CANCELED
: The carrier app should treat this as if the user pressed
the back button.
Anything else: The carrier app should treat this as an error.
LPA needs to check if caller's package name is allowed to perform this action.
Constant Value: "android.telephony.euicc.action.START_EUICC_ACTIVATION"
EMBEDDED_SUBSCRIPTION_RESULT_ERROR
public static final int EMBEDDED_SUBSCRIPTION_RESULT_ERROR
Result code for an operation indicating that an unresolvable error occurred.
EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE
will be populated with a detailed error
code for logging/debugging purposes only.
Constant Value: 2 (0x00000002)
EMBEDDED_SUBSCRIPTION_RESULT_OK
public static final int EMBEDDED_SUBSCRIPTION_RESULT_OK
Result code for an operation indicating that the operation succeeded.
Constant Value: 0 (0x00000000)
EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR
public static final int EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR
Result code for an operation indicating that the user must take some action before the operation can continue.
Constant Value: 1 (0x00000001)
ERROR_ADDRESS_MISSING
public static final int ERROR_ADDRESS_MISSING
Address is missing e.g SMDS/SMDP address is missing.
See also:
Constant Value: 10011 (0x0000271b)
ERROR_CARRIER_LOCKED
public static final int ERROR_CARRIER_LOCKED
Operation such as downloading/switching to another profile failed due to device being carrier locked.
See also:
Constant Value: 10000 (0x00002710)
ERROR_CERTIFICATE_ERROR
public static final int ERROR_CERTIFICATE_ERROR
Certificate needed for authentication is not valid or missing. E.g SMDP/SMDS authentication failed.
See also:
Constant Value: 10012 (0x0000271c)
ERROR_CONNECTION_ERROR
public static final int ERROR_CONNECTION_ERROR
Failure to create a connection.
See also:
Constant Value: 10014 (0x0000271e)
ERROR_DISALLOWED_BY_PPR
public static final int ERROR_DISALLOWED_BY_PPR
Failed to load profile onto eUICC due to Profile Policy Rules.
See also:
Constant Value: 10010 (0x0000271a)
ERROR_EUICC_INSUFFICIENT_MEMORY
public static final int ERROR_EUICC_INSUFFICIENT_MEMORY
There is no more space available on the eUICC for new profiles.
See also:
Constant Value: 10004 (0x00002714)
ERROR_EUICC_MISSING
public static final int ERROR_EUICC_MISSING
eUICC is missing or defective on the device.
See also:
Constant Value: 10006 (0x00002716)
ERROR_INCOMPATIBLE_CARRIER
public static final int ERROR_INCOMPATIBLE_CARRIER
The profile's carrier is incompatible with the LPA.
See also:
Constant Value: 10003 (0x00002713)
ERROR_INSTALL_PROFILE
public static final int ERROR_INSTALL_PROFILE
Failure to load the profile onto the eUICC card. e.g 1. iccid of the profile already exists on the eUICC. 2. GSMA(.22 v2.2) Profile Install Result - installFailedDueToDataMismatch 3. operation was interrupted 4. SIMalliance error in PEStatus(SGP.22 v2.2 section 2.5.6.1)
See also:
Constant Value: 10009 (0x00002719)
ERROR_INVALID_ACTIVATION_CODE
public static final int ERROR_INVALID_ACTIVATION_CODE
The activation code(SGP.22 v2.2 section[4.1]) is invalid.
See also:
Constant Value: 10001 (0x00002711)
ERROR_INVALID_CONFIRMATION_CODE
public static final int ERROR_INVALID_CONFIRMATION_CODE
The confirmation code(SGP.22 v2.2 section[4.7]) is invalid.
See also:
Constant Value: 10002 (0x00002712)
ERROR_INVALID_PORT
public static final int ERROR_INVALID_PORT
Failure due to target port is not supported.
Constant Value: 10017 (0x00002721)
ERROR_INVALID_RESPONSE
public static final int ERROR_INVALID_RESPONSE
Response format is invalid. e.g SMDP/SMDS response contains invalid json, header or/and ASN1.
See also:
Constant Value: 10015 (0x0000271f)
ERROR_NO_PROFILES_AVAILABLE
public static final int ERROR_NO_PROFILES_AVAILABLE
No profiles available.
See also:
Constant Value: 10013 (0x0000271d)
ERROR_OPERATION_BUSY
public static final int ERROR_OPERATION_BUSY
The operation is currently busy, try again later.
See also:
Constant Value: 10016 (0x00002720)
ERROR_SIM_MISSING
public static final int ERROR_SIM_MISSING
No SIM card is available in the device.
See also:
Constant Value: 10008 (0x00002718)
ERROR_TIME_OUT
public static final int ERROR_TIME_OUT
Timed out while waiting for an operation to complete. i.e restart, disable, switch reset etc.
See also:
Constant Value: 10005 (0x00002715)
ERROR_UNSUPPORTED_VERSION
public static final int ERROR_UNSUPPORTED_VERSION
The eUICC card(hardware) version is incompatible with the software
See also:
Constant Value: 10007 (0x00002717)
EUICC_MEMORY_FIELD_UNAVAILABLE
public static final long EUICC_MEMORY_FIELD_UNAVAILABLE
Temporary failure to retrieve available memory because eUICC is not ready.
Constant Value: -1 (0xffffffffffffffff)
EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE
public static final String EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE
Key for an extra set on PendingIntent
result callbacks providing a detailed result
code.
The value of this key is an integer and contains two portions. The first byte is
OperationCode and the reaming three bytes is the ErrorCode.
OperationCode is the first byte of the result code and is a categorization which defines what
type of operation took place when an error occurred. e.g OPERATION_DOWNLOAD
means
the error is related to download.Since the OperationCode only uses at most one byte, the
maximum allowed quantity is 255(0xFF).
ErrorCode is the remaining three bytes of the result code, and it denotes what happened.
e.g a combination of OPERATION_DOWNLOAD
and ERROR_TIME_OUT
will suggest the
download operation has timed out. The only exception here is
OPERATION_SMDX_SUBJECT_REASON_CODE
, where instead of ErrorCode, SubjectCode[5.2.6.1
from GSMA (SGP.22 v2.2) and ReasonCode[5.2.6.2] from GSMA (SGP.22 v2.2) are encoded. @see
EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE
and
EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE
In the case where ErrorCode contains a value of 0, it means it's an unknown error. E.g Intent
only contains OPERATION_DOWNLOAD
and ErrorCode is 0 implies this is an unknown
Download error.
See also:
Constant Value: "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DETAILED_CODE"
EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION
public static final String EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION
Key for an extra set on #getDownloadableSubscriptionMetadata
PendingIntent result
callbacks providing the downloadable subscription metadata.
Constant Value: "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION"
EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE
public static final String EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE
Key for an extra set on PendingIntent
result callbacks providing a
ErrorCode of EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE
,
value will be an int.
Constant Value: "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_ERROR_CODE"
EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE
public static final String EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE
Key for an extra set on PendingIntent
result callbacks providing a
OperationCode of EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE
,
value will be an int.
Constant Value: "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_OPERATION_CODE"
EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE
public static final String EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE
Key for an extra set on PendingIntent
result callbacks providing a
ReasonCode[5.2.6.2] from GSMA (SGP.22 v2.2) decoded from
EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE
.
The value of this extra will be a String.
Constant Value: "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE"
EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE
public static final String EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE
Key for an extra set on PendingIntent
result callbacks providing a
SubjectCode[5.2.6.1] from GSMA (SGP.22 v2.2) decoded from
EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE
.
The value of this extra will be a String.
Constant Value: "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE"
EXTRA_USE_QR_SCANNER
public static final String EXTRA_USE_QR_SCANNER
Key for an extra set on actions ACTION_START_EUICC_ACTIVATION
providing a boolean
value of whether to start eSIM activation with QR scanner.
Expected type of the extra data: boolean
Constant Value: "android.telephony.euicc.extra.USE_QR_SCANNER"
META_DATA_CARRIER_ICON
public static final String META_DATA_CARRIER_ICON
Optional meta-data attribute for a carrier app providing an icon to use to represent the carrier. If not provided, the app's launcher icon will be used as a fallback.
Constant Value: "android.telephony.euicc.carriericon"
OPERATION_APDU
public static final int OPERATION_APDU
The exception of failing to execute an APDU command. It can be caused by an error happening on opening the basic or logical channel, or the response of the APDU command is not success (0x9000).
See also:
Constant Value: 8 (0x00000008)
OPERATION_DOWNLOAD
public static final int OPERATION_DOWNLOAD
Download profile error.
See also:
Constant Value: 5 (0x00000005)
OPERATION_EUICC_CARD
public static final int OPERATION_EUICC_CARD
eUICC card error.
See also:
Constant Value: 3 (0x00000003)
OPERATION_EUICC_GSMA
public static final int OPERATION_EUICC_GSMA
eUICC returned an error defined in GSMA (SGP.22 v2.2) while running one of the ES10x functions.
See also:
Constant Value: 7 (0x00000007)
OPERATION_HTTP
public static final int OPERATION_HTTP
HTTP error
See also:
Constant Value: 11 (0x0000000b)
OPERATION_METADATA
public static final int OPERATION_METADATA
Subscription's metadata error
See also:
Constant Value: 6 (0x00000006)
OPERATION_SIM_SLOT
public static final int OPERATION_SIM_SLOT
SIM slot error. Failed to switch slot, failed to access the physical slot etc.
See also:
Constant Value: 2 (0x00000002)
OPERATION_SMDX
public static final int OPERATION_SMDX
SMDX(SMDP/SMDS) error
See also:
Constant Value: 9 (0x00000009)
OPERATION_SMDX_SUBJECT_REASON_CODE
public static final int OPERATION_SMDX_SUBJECT_REASON_CODE
SubjectCode[5.2.6.1] and ReasonCode[5.2.6.2] error from GSMA (SGP.22 v2.2)
When OPERATION_SMDX_SUBJECT_REASON_CODE
is used as the
EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE
, the remaining three bytes of the integer
result from EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE
will be used to stored the
SubjectCode and ReasonCode from the GSMA spec and NOT ErrorCode.
The encoding will follow the format of:
1. The first byte of the result will be 255(0xFF).
2. Remaining three bytes(24 bits) will be split into six sections, 4 bits in each section.
3. A SubjectCode/ReasonCode will take 12 bits each.
4. The maximum number can be represented per section is 15, as that is the maximum number
allowed to be stored into 4 bits
5. Maximum supported nested category from GSMA is three layers. E.g 8.11.1.2 is not
supported.
E.g given SubjectCode(8.11.1) and ReasonCode(5.1)
Base10: 0 10 8 11 1 0 5 1
Base2: 0000 1010 1000 1011 0001 0000 0101 0001
Base16: 0 A 8 B 1 0 5 1
Thus the integer stored in EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE
is
0xA8B1051(176885841)
See also:
Constant Value: 10 (0x0000000a)
OPERATION_SWITCH
public static final int OPERATION_SWITCH
Generic switching profile error
See also:
Constant Value: 4 (0x00000004)
OPERATION_SYSTEM
public static final int OPERATION_SYSTEM
Internal system error.
See also:
Constant Value: 1 (0x00000001)
Public methods
createForCardId
public EuiccManager createForCardId (int cardId)
Create a new EuiccManager object pinned to the given card ID.
Parameters | |
---|---|
cardId |
int |
Returns | |
---|---|
EuiccManager |
an EuiccManager that uses the given card ID for all calls.
This value cannot be null . |
deleteSubscription
public void deleteSubscription (int subscriptionId, PendingIntent callbackIntent)
Deletes the given subscription.
If this subscription is currently active, the device will first switch away from it onto an "empty" subscription.
Requires that the calling app has carrier privileges according to the metadata of the
profile to be deleted, or the
android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS
permission.
Starting from Android Build.VERSION_CODES.VANILLA_ICE_CREAM
, if the
caller is a device owner, profile owner, or holds the
android.Manifest.permission#MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS
permission,
then the caller can delete a subscription that was downloaded by that caller.
If such a caller tries to delete any other subscription then the
operation will fail with EMBEDDED_SUBSCRIPTION_RESULT_ERROR
.
Requires android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS or Manifest.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS
Parameters | |
---|---|
subscriptionId |
int : the ID of the subscription to delete. |
callbackIntent |
PendingIntent : a PendingIntent to launch when the operation completes. |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_EUICC . |
downloadSubscription
public void downloadSubscription (DownloadableSubscription subscription, boolean switchAfterDownload, PendingIntent callbackIntent)
Attempt to download the given DownloadableSubscription
.
Requires the android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS
or the calling app must be authorized to manage both the currently-active
subscription on the
current eUICC and the subscription to be downloaded 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.
Starting from Android Build.VERSION_CODES.VANILLA_ICE_CREAM
,
if the caller has the
android.Manifest.permission#MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS
permission or
is a profile owner or device owner, then the downloaded subscription
will be managed by that caller.
In case the caller is device owner or profile owner of an organization-owned device, switchAfterDownload
can be set to true to automatically enable the subscription after
download. If the caller is a profile owner on non organization owned device
switchAfterDownload
should be false otherwise the operation will fail with
EMBEDDED_SUBSCRIPTION_RESULT_ERROR
.
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 downloaded.
If device support PackageManager#FEATURE_TELEPHONY_EUICC_MEP
and
switchAfterDownload is true
, the subscription will be enabled on an esim port based
on the following selection rules:
- In SS(Single SIM) mode, if the embedded slot already has an active port, then download and enable the subscription on this port.
- In SS mode, if the embedded slot is not active, then try to download and enable the subscription on the default port 0 of eUICC.
- In DSDS mode, find first available port to download and enable the subscription.
(see
isSimPortAvailable(int)
)
EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR
will be returned in the callback intent to prompt the user to disable an already-active
subscription.
Requires android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS or
Manifest.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS
Parameters | |
---|---|
subscription |
DownloadableSubscription : the subscription to download. |
switchAfterDownload |
boolean : if true, the profile will be activated upon successful download. |
callbackIntent |
PendingIntent : a PendingIntent to launch when the operation completes. |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_EUICC . |
getAvailableMemoryInBytes
public long getAvailableMemoryInBytes ()
Returns the available memory in bytes of the eUICC.
Requires Manifest.permission.READ_PHONE_STATE
or android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE or carrier privileges
Returns | |
---|---|
long |
the available memory in bytes. May be EUICC_MEMORY_FIELD_UNAVAILABLE if the
eUICC is not ready. Check isEnabled() for more information. |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_EUICC or
device doesn't support querying this information from the eUICC. |
getEid
public String getEid ()
Returns the EID identifying the eUICC hardware.
Requires that the calling app has carrier privileges on the active subscription on the current eUICC. A calling app with carrier privileges for one eUICC may not necessarily have access to the EID of another eUICC.
Returns | |
---|---|
String |
the EID. May be null if the eUICC is not ready. |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_EUICC . |
getEuiccInfo
public EuiccInfo getEuiccInfo ()
Returns information about the eUICC chip/device.
Returns | |
---|---|
EuiccInfo |
the EuiccInfo . May be null if the eUICC is not ready. |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_EUICC . |
isEnabled
public boolean isEnabled ()
Whether embedded subscriptions are currently enabled.
Even on devices with the PackageManager#FEATURE_TELEPHONY_EUICC
feature, embedded
subscriptions may be turned off, e.g. because of a carrier restriction from an inserted
physical SIM. Therefore, this runtime check should be used before accessing embedded
subscription APIs.
Returns | |
---|---|
boolean |
true if embedded subscriptions are currently enabled. |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_EUICC . |
isSimPortAvailable
public boolean isSimPortAvailable (int portIndex)
Returns whether the passing portIndex is available. A port is available if it is active without enabled profile on it or calling app has carrier privilege over the profile installed on the selected port.
From Android U, a port is available if it is active without an enabled profile on it or calling app can activate a new profile on the selected port without any user interaction. Always returns false if the cardId is a physical card.
Parameters | |
---|---|
portIndex |
int : is an enumeration of the ports available on the UICC. |
Returns | |
---|---|
boolean |
true if port is available |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_EUICC . |
startResolutionActivity
public void startResolutionActivity (Activity activity, int requestCode, Intent resultIntent, PendingIntent callbackIntent)
Start an activity to resolve a user-resolvable error.
If an operation returns EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR
, this
method may be called to prompt the user to resolve the issue.
This method may only be called once for a particular error.
Parameters | |
---|---|
activity |
Activity : the calling activity (which should be in the foreground). |
requestCode |
int : an application-specific request code which will be provided to
Activity#onActivityResult upon completion. Note that the operation may still be
in progress when the resolution activity completes; it is not fully finished until the
callback intent is triggered. |
resultIntent |
Intent : the Intent provided to the initial callback intent which failed with
EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR . |
callbackIntent |
PendingIntent : a PendingIntent to launch when the operation completes. This is
trigered upon completion of the original operation that required user resolution. |
Throws | |
---|---|
IntentSender.SendIntentException |
if called more than once. |
switchToSubscription
public void switchToSubscription (int subscriptionId, PendingIntent callbackIntent)
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, android.app.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:
- always use the default port 0 is eUICC does not support MEP or the apps are not targeting on Android T.
- In SS(Single SIM) mode, if the embedded slot already has an active port, then enable the subscription on this port.
- In SS mode, if the embedded slot is not active, then try to enable the subscription on the default port 0 of eUICC.
- In DSDS mode, find first available port to enable the subscription.
(see
isSimPortAvailable(int)
)
EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR
will be returned in the callback intent to prompt the user to disable an already-active
subscription.
Requires android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS
Parameters | |
---|---|
subscriptionId |
int : the ID of the subscription to enable. May be
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, android.app.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. |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_EUICC . |
switchToSubscription
public void switchToSubscription (int subscriptionId, int portIndex, PendingIntent callbackIntent)
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:
- index is beyond the range of
UiccCardInfo#getPorts()
. - In SS(Single SIM) mode, the embedded slot already has an active port with different port index.
- In DSDS mode, if the psim slot is active and the embedded slot already has an active empty port with different port index.
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.
Requires android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS
Parameters | |
---|---|
subscriptionId |
int : the ID of the subscription to enable. May be
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, android.app.PendingIntent)
API for disable profile, port index can be found from
SubscriptionInfo#getPortIndex() . |
portIndex |
int : the index of the port to target for the enabled subscription |
callbackIntent |
PendingIntent : a PendingIntent to launch when the operation completes.
This value cannot be null . |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_EUICC . |
updateSubscriptionNickname
public void updateSubscriptionNickname (int subscriptionId, String nickname, PendingIntent callbackIntent)
Update the nickname for the given subscription.
Requires that the calling app has carrier privileges according to the metadata of the
profile to be updated, or the
android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS
permission.
Requires android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS
Parameters | |
---|---|
subscriptionId |
int : the ID of the subscription to update. |
nickname |
String : the new nickname to apply.
This value may be null . |
callbackIntent |
PendingIntent : a PendingIntent to launch when the operation completes.
This value cannot be null . |
Throws | |
---|---|
UnsupportedOperationException |
If the device does not have
PackageManager#FEATURE_TELEPHONY_EUICC . |