From b4ad213d4887d29dd11af35b50c7a900e1b4875d Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Mon, 22 Jan 2024 11:20:36 -0300 Subject: [PATCH] update docs to show how to check if amber is installed --- README.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e028646c..b012be3a 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,32 @@ Amber is a nostr event signer for Android. It allows users to keep their nsec se Amber uses Intents and Content Resolvers to communicate between applications. -To be able to use Amber in your application you should add the following package visibility needs: +To be able to use Amber in your application you should add the following in your AndroidManifest.xml: ```xml - + + + + + ``` +Then you can use this function to check if there's an external signer 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 Amber 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.