anbu selvan
anbu selvan

Reputation: 745

Sample eSim LPA in Android

I am trying to learn about e Sim implementation in Android. While going through the docs here i tried to understand the EuiccManager so used the below code from the same docs:-

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
        EuiccManager euiccManager = getApplication().getSystemService(EuiccManager.class);
        boolean isEnabled = euiccManager.isEnabled();
        if (!isEnabled) {     
            return;       //always isEnabled is false
        }
    }

I used Note 9 real device with Android 9(Pie) version for testing the code so we need to add any permission in Manifest file or am i missing something.

Upvotes: 1

Views: 3698

Answers (3)

柏占彬
柏占彬

Reputation: 1

I also encountered the same problem. When I tried on several devices, all of them were false. I wonder if it is the reason that the device does not support eSIM. System permissions according to the document added all I need, also added a feature android. Hardware. A telephony. The euicc (using the PackageManager hasSystemFeature check, the result is true).

Upvotes: 0

regarding the manifest file you might need to add these

<uses-permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/>
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>

Upvotes: 0

Fawzan
Fawzan

Reputation: 4849

Try the following snippet with Context.EUICC_SERVICE .

EuiccManager euiccManager = (EuiccManager)context.getSystemService(Context.EUICC_SERVICE);

EuiccManager#isEnabled() generally returns true if the android.hardware.telephony.euicc feature is defined and an LPA package is present.

https://source.android.com/devices/tech/connect/esim-overview

Upvotes: 2

Related Questions