Skip to content

Callback not triggered after connecting device via Settings intent #106

Open

Description

@aliiraj

Hi
I'm using the following code to launch the Zettle Settings screen, where the user can connect a payment device. After the device is connected, I expect the result to be returned to the ActivityResultLauncher so I can save the connected device. However, the callback is not triggered after connecting a device. It only triggers (with a cancel state) after the user manually presses the back arrow in the Settings screen.

val connectLauncher =
rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { activityResult ->
if (activityResult.resultCode != Activity.RESULT_OK) {
return@rememberLauncherForActivityResult
}

        when (activityResult.data?.zettleResult()) {
            is ZettleResult.Completed<*> -> {
                viewModel.dispatchIntent(ConnectPaymentDeviceIntent.SaveDevice)
            }

            else -> {}
        }
    }

val intent = CardReaderAction.Settings.show(context)
connectLauncher.launch(intent)

Expected behavior:
After the user connects a device via the Zettle Settings screen, the result should be returned, triggering the ZettleResult.Completed case.

Activity

  1. CheZhongSdk commented on Apr 4, 2025

    @CheZhongSdk
    Collaborator

    @aliiraj Thank you for reaching out and good question about the Readers Settings screen. As you pointed out, the CardReaderAction.Settings.show action is designed to only launch the UI screen and does not return data via ActivityResult. I will share your feedback with the team for internal review, and we will keep you informed of any updates.

  2. CheZhongSdk commented on Apr 8, 2025

    @CheZhongSdk
    Collaborator

    Hi @aliiraj, we have a follow-up question regarding this function. Could you please provide more details about its intended use cases? If it's not convenient to discuss this here, please open a ticket using this link: Developer Support - SDK payments and refunds Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions