Android14 - Flutter App: Issue with eSIM Download Functionality

51 Views Asked by At

I'm encountering an issue with my Flutter app's functionality (only for Android 14) related to downloading eSIMs directly from my application. The flow of the process involves a button within the app that triggers the download of an eSIM. Upon clicking the button, the user is taken to the device settings eSIM page to begin the eSIM addition process. Once the eSIM is downloaded, the user is redirected back to the app.

To achieve this, I'm using an intent to start the LPA activity, allowing the user to continue the process through their device's built-in Settings app. Here's a snippet of the code:

private var lpaActivityIntent = Intent().apply {
    action = EuiccManager.ACTION_START_EUICC_ACTIVATION
    putExtra(EuiccManager.EXTRA_USE_QR_SCANNER, false)
}

mainActivity.startActivityForResult(lpaActivityIntent, ACTIVATE_ACTIVITY_CODE)

Platform Channel Communication: The result of the eSIM activation process will be communicated back to the Dart side (Flutter) using a platform channel. Depending on the result code received (RESULT_OK, RESULT_CANCELED, or others), appropriate callbacks will be invoked to communicate the result back to the Flutter side.

activateCallback?.invoke(Result.success(ActivateEsimReply(ServiceResult.OK)))

This approach works fine until Android 13, where I receive RESULT_OK upon successful installation. However, on Android 14, even though the eSIM installation is successful, I consistently receive RESULT_CANCELED.

I'm seeking guidance on how to address this issue and ensure consistent behavior across different Android versions, especially regarding the receipt of the correct result code upon eSIM installation. Any insights or suggestions would be greatly appreciated.

What i tried:

I attempted to initiate the eSIM activation process within my Flutter app by utilizing Android's EuiccManager.ACTION_START_EUICC_ACTIVATION action. Here's a breakdown of the steps I followed:

  1. Created an intent to start the LPA (Logical Profile Assistant) activity for eSIM activation.
  2. Passed necessary parameters, such as EXTRA_USE_QR_SCANNER, to the intent.
  3. Attempted to start the activity using startActivityForResult().
  4. Implemented a method, onActivate(), to handle the result of the eSIM activation process.

What i am expecting:

I expected that upon initiating the eSIM activation process, the user would be taken to the appropriate system activity where they can complete the eSIM activation. Upon successful activation, I expected to receive a result code of RESULT_OK, which I would handle accordingly in the onActivate() method. Similarly, if the user canceled the activation process, I anticipated receiving a result code of RESULT_CANCELED to handle appropriately.

However, when testing on devices running Android 14 or higher, I consistently received a result code of RESULT_CANCELED, even after successful eSIM activation. This behavior was unexpected and deviated from the expected result code of RESULT_OK.

I'm seeking guidance on how to address this issue and ensure consistent behavior across different Android versions, especially regarding the receipt of the correct result code upon eSIM activation. Any insights or suggestions would be greatly appreciated.

0

There are 0 best solutions below