How do I get the permissions for WRITE_EMBEDDED_SUBSCRIPTIONS
?
In android development, I'm developing a feature to download eSIM devices directly.
However, the WRITE_EMBEDDED_SUBSCRIPTIONS
permission mentioned in the documentation always returns false.
How can I resolve this?
I have added the following code to AndroidManifest.xml.
<uses-permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/>
This is how permission is called
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == PERMISSION_REQUEST_CODE) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Log.d("TAG", "Permitted")
}
{ else {
// Always returned false here
Log.d("TAG", "Not Permitted")
}
}
}
.
.
.
// Called permission request
checkSelfPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS") == PackageManager.PERMISSION_GRANTED
requestPermissions(arrayOf("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"), PERMISSION_REQUEST_CODE)
The source document I'm looking at is here. https://source.android.com/devices/tech/connect/esim-euicc-api?hl=ja
You can not get this permission, because it's only granted to system apps but you don't need this permission to install/delete/enable an eSIM, instead of this permission you should have the carrier privileges on the specific eSIM profile. So that you will be able to manage the eSIMs that you have the carrier privileges.
See more about the carrier privilege mechanism.