diff --git a/100.md b/100.md index 79ced80..24bf09f 100644 --- a/100.md +++ b/100.md @@ -40,6 +40,24 @@ fun isExternalSignerInstalled(context: Context): Boolean { To get the result back from the Signer Application you should use `registerForActivityResult` or `rememberLauncherForActivityResult` in Kotlin. If you are using another framework check the documentation of your framework or a third party library to get the result. +```kotlin +val launcher = rememberLauncherForActivityResult( + contract = ActivityResultContracts.StartActivityForResult(), + onResult = { result -> + if (result.resultCode != Activity.RESULT_OK) { + Toast.makeText( + context, + "Sign request rejected", + Toast.LENGTH_SHORT + ).show() + } else { + val signature = activityResult.data?.getStringExtra("signature") + // Do something with signature ... + } + } +) +``` + Create the Intent using the **nostrsigner** scheme: ```kotlin @@ -52,6 +70,12 @@ Set the Signer package name: intent.`package` = "com.example.signer" ``` +Send the Intent: + +```kotlin +launcher.launch(intent) +``` + ### Methods - **get_public_key**