change androidmanifest.xml, add rejected collumn if user chose to always reject some event kind

This commit is contained in:
greenart7c3 2024-01-22 11:25:25 -03:00
parent e050386b84
commit c55678b307

24
100.md
View File

@ -10,14 +10,32 @@ This NIP describes a method for 2-way communication between a android signer and
The Android signer uses Intents and Content Resolvers to communicate between applications.
To be able to use The Android signer in your application you should add the package name of the signer to your AndroidManifest.xml:
To be able to use The Android signer in your application you should this to your AndroidManifest.xml:
```xml
<queries>
<package android:name="com.example.signer"/>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="nostrsigner" />
</intent>
</queries>
```
Then you can use this function to check if there's a signer application installed:
```kotlin
fun isExternalSignerInstalled(context: Context): Boolean {
val intent =
Intent().apply {
action = Intent.ACTION_VIEW
data = Uri.parse("nostrsigner:")
}
val infos = context.packageManager.queryIntentActivities(intent, 0)
return infos.size > 0
}
```
## Using Intents
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 "
For the other types Signer Application returns the column "signature"
If the user chose to always reject the event signer application will return the column "rejected" and you should not open signer application
### Methods
- **get_public_key**