EuiccManager switchToSubscription

779 Views Asked by At

I am prototyping an eSIM install/subscription use case by following the following doc: https://source.android.com/devices/tech/connect/esim-overview:

I have successfully download the profile that I can subscribe to it if I use the device settings app. However it fails silently if I try to subscribe to it using the following API:

mgr.switchToSubscription(1 /* subscriptionId */, callbackIntent);

Anyone has any pointer what is subscriptionId? or any pointer how to look for more info?

1

There are 1 best solutions below

0
On BEST ANSWER

Subscription ID the the ID used by SubscriptionManager, which you can get from SubscriptionInfo.getSubscriptionId() or the getSubscriptionIds() method.

Unfortunately, the documentation for that class is quite sparse. But if you just need to know the subscription ID of your eSIM, you can use the adb command

adb shell dumpsys isub

which will show you all of the available subscriptions as well as the currently active ones.

Note also that downloadSubscription has a switchAfterDownload method, so you don't need to get the subscription ID to switch to it manually, if you have the download operation immediately preceding it.