diff --git a/README.md b/README.md index 2860c59..e77cdcb 100644 --- a/README.md +++ b/README.md @@ -55,9 +55,7 @@ Follow all Stripe instructions under ["Configure your app"](https://stripe.com/d ### Android -Follow all Stripe instructions under ["Configure your app"](https://stripe.com/docs/terminal/sdk/android#configure). - -Add the plugin to your `MainActivity.java`. +Add the plugin to your `MainActivity.java`: ```java // import it at the top @@ -70,6 +68,36 @@ this.init(savedInstanceState, new ArrayList>() {{ }}); ``` +Add the `ACCESS_FINE_LOCATION`, `BLUETOOTH`, and `BLUETOOTH_ADMIN` permissions to your app's manifest: + +```xml + + + + + + + +``` + +On Android, you must also make sure that Location permission has been granted by the user: + +```javascript +const response = await StripeTerminalPlugin.getPermissions() + +if (!response.granted) { + throw new Error('Location permission is required.') +} + +const terminal = new StripeTerminalPlugin() +``` + +If the user does not grant permission, `StripeTerminalPlugin` will throw an error when you try to initialize it so you will have to handle that. + +_Hint: If the user denies Location permission the first time you ask for it, Android will not display a prompt to the user on subsequent requests for permission and `response.granted` will always be `false`. You will have to ask the user to go into the app's settings to allow Location permission._ + ## Usage ```javascript