diff options
| author | greenart7c3 <115044884+greenart7c3@users.noreply.github.com> | 2025-02-17 15:09:37 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-17 13:09:37 -0500 |
| commit | 330de34c7cc8fc6f34e3dec076f20ceb1af94927 (patch) | |
| tree | f98f7d60c01eaab7ddfe00508132bd9a063bfb54 /55.md | |
| parent | 8e6f2c06c3ec88a6c478a783825ff1b07e1972fa (diff) | |
[NIP-55] Make it clear how to use the package name and what is the purpose of the intents and content resolvers (#1791)
Diffstat (limited to '55.md')
| -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") |