diff options
| -rw-r--r-- | 55.md | 7 |
1 files changed, 3 insertions, 4 deletions
| @@ -10,7 +10,7 @@ This NIP describes a method for 2-way communication between an Android signer an | |||
| 10 | 10 | ||
| 11 | # Usage for Android applications | 11 | # Usage for Android applications |
| 12 | 12 | ||
| 13 | The Android signer uses Intents and Content Resolvers to communicate between applications. | 13 | The Android signer uses Intents (to accept/reject permissions manually) and Content Resolvers (to accept/reject permissions automatically in background if the user allowed it) to communicate between applications. |
| 14 | 14 | ||
| 15 | To be able to use the Android signer in your application you should add this to your AndroidManifest.xml: | 15 | To be able to use the Android signer in your application you should add this to your AndroidManifest.xml: |
| 16 | 16 | ||
| @@ -66,7 +66,7 @@ Create the Intent using the **nostrsigner** scheme: | |||
| 66 | val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:$content")) | 66 | val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:$content")) |
| 67 | ``` | 67 | ``` |
| 68 | 68 | ||
| 69 | Set the Signer package name: | 69 | Set the Signer package name after you receive the response from **get_public_key** method: |
| 70 | 70 | ||
| 71 | ```kotlin | 71 | ```kotlin |
| 72 | intent.`package` = "com.example.signer" | 72 | intent.`package` = "com.example.signer" |
| @@ -114,7 +114,6 @@ launcher.launch(intent) | |||
| 114 | 114 | ||
| 115 | ```kotlin | 115 | ```kotlin |
| 116 | val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:")) | 116 | val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:")) |
| 117 | intent.`package` = "com.example.signer" | ||
| 118 | intent.putExtra("type", "get_public_key") | 117 | intent.putExtra("type", "get_public_key") |
| 119 | // You can send some default permissions for the user to authorize for ever | 118 | // You can send some default permissions for the user to authorize for ever |
| 120 | val permissions = listOf( | 119 | val permissions = listOf( |
| @@ -130,7 +129,7 @@ launcher.launch(intent) | |||
| 130 | context.startActivity(intent) | 129 | context.startActivity(intent) |
| 131 | ``` | 130 | ``` |
| 132 | - result: | 131 | - result: |
| 133 | - If the user approved intent it will return the **pubkey** in the result field | 132 | - If the user approved the intent it will return the **pubkey** in the result field and the signer packageName in the **package** field |
| 134 | 133 | ||
| 135 | ```kotlin | 134 | ```kotlin |
| 136 | val pubkey = intent.data?.getStringExtra("result") | 135 | val pubkey = intent.data?.getStringExtra("result") |