diff options
| author | greenart7c3 <greenart7c3@proton.me> | 2024-01-22 11:25:25 -0300 |
|---|---|---|
| committer | greenart7c3 <greenart7c3@proton.me> | 2024-01-22 11:25:25 -0300 |
| commit | c55678b30740c1aa4aa968239fb21fb05c38a92c (patch) | |
| tree | 92ca1916378e56186e965d1c81029fa8f8c03c1d /100.md | |
| parent | e050386b849d0d293903a46646c89233bf19f489 (diff) | |
change androidmanifest.xml, add rejected collumn if user chose to always reject some event kind
Diffstat (limited to '100.md')
| -rw-r--r-- | 100.md | 24 |
1 files changed, 22 insertions, 2 deletions
| @@ -10,14 +10,32 @@ This NIP describes a method for 2-way communication between a android signer and | |||
| 10 | 10 | ||
| 11 | The Android signer uses Intents and Content Resolvers to communicate between applications. | 11 | The Android signer uses Intents and Content Resolvers to communicate between applications. |
| 12 | 12 | ||
| 13 | To be able to use The Android signer in your application you should add the package name of the signer to your AndroidManifest.xml: | 13 | To be able to use The Android signer in your application you should this to your AndroidManifest.xml: |
| 14 | 14 | ||
| 15 | ```xml | 15 | ```xml |
| 16 | <queries> | 16 | <queries> |
| 17 | <package android:name="com.example.signer"/> | 17 | <intent> |
| 18 | <action android:name="android.intent.action.VIEW" /> | ||
| 19 | <category android:name="android.intent.category.BROWSABLE" /> | ||
| 20 | <data android:scheme="nostrsigner" /> | ||
| 21 | </intent> | ||
| 18 | </queries> | 22 | </queries> |
| 19 | ``` | 23 | ``` |
| 20 | 24 | ||
| 25 | Then you can use this function to check if there's a signer application installed: | ||
| 26 | |||
| 27 | ```kotlin | ||
| 28 | fun isExternalSignerInstalled(context: Context): Boolean { | ||
| 29 | val intent = | ||
| 30 | Intent().apply { | ||
| 31 | action = Intent.ACTION_VIEW | ||
| 32 | data = Uri.parse("nostrsigner:") | ||
| 33 | } | ||
| 34 | val infos = context.packageManager.queryIntentActivities(intent, 0) | ||
| 35 | return infos.size > 0 | ||
| 36 | } | ||
| 37 | ``` | ||
| 38 | |||
| 21 | ## Using Intents | 39 | ## Using Intents |
| 22 | 40 | ||
| 23 | To get the result back from the Signer Appication 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. | 41 | To get the result back from the Signer Appication 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. |
| @@ -221,6 +239,8 @@ For the SIGN_EVENT type Signer Application returns two columns "signature" and " | |||
| 221 | 239 | ||
| 222 | For the other types Signer Application returns the column "signature" | 240 | For the other types Signer Application returns the column "signature" |
| 223 | 241 | ||
| 242 | If the user chose to always reject the event signer application will return the column "rejected" and you should not open signer application | ||
| 243 | |||
| 224 | ### Methods | 244 | ### Methods |
| 225 | 245 | ||
| 226 | - **get_public_key** | 246 | - **get_public_key** |