Skip to content

Commit 468ec71

Browse files
authored
Simplify documentation re: Android permissions setup (#416)
1 parent ea4d5a3 commit 468ec71

1 file changed

Lines changed: 74 additions & 18 deletions

File tree

README.md

Lines changed: 74 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -454,33 +454,89 @@ cancellation is provided to prevent connection leaks._
454454

455455
## Setup
456456

457-
### Android
457+
### Android Permissions
458+
459+
Kable [declares permissions for common use cases](core/src/androidMain/AndroidManifest.xml), but your app's
460+
configuration may need to be adjusted under the following conditions:
461+
462+
<table>
463+
<tr>
464+
<td align="center">Your app...</td>
465+
<td align="center"><code>AndroidManifest.xml</code> additions</td>
466+
</tr>
458467

459-
Kable declares common bluetooth permissions but doesn't declare that bluetooth hardware is required. If your app
460-
requires bluetooth (and won't function without it), then the following should be added to your app's
461-
`AndroidManifest.xml`:
468+
<tr>
469+
<td>
470+
471+
[Obtains the user's location (e.g. maps)](https://developer.android.com/training/location/permissions#foreground)
472+
473+
</td>
474+
<td>
462475

463476
```xml
464-
<manifest ..>
465-
<uses-feature
466-
android:name="android.hardware.bluetooth_le"
467-
android:required="true"/>
468-
</manifest>
477+
<uses-permission
478+
android:name="android.permission.ACCESS_COURSE_LOCATION"
479+
tools:node="replace"/>
480+
<uses-permission
481+
android:name="android.permission.ACCESS_FINE_LOCATION"
482+
tools:node="replace"/>
469483
```
470484

471-
Kable declares the `BLUETOOTH_SCAN` permission with the assumption that your app will not derive physical location from
472-
scan results. If this is not true (and your app will derive physical location), then the following should be added to
473-
your app's `AndroidManifest.xml`:
485+
</td>
486+
</tr>
487+
488+
<tr>
489+
<td>
490+
491+
[Derives the user's location from Bluetooth Low Energy scans](https://developer.android.com/guide/topics/connectivity/bluetooth/permissions#declare-android12-or-higher)
492+
493+
</td>
494+
<td>
474495

475496
```xml
476-
<manifest ..>
477-
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" tools:node="remove"/>
478-
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
479-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove"/>
480-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
481-
</manifest>
497+
<uses-permission
498+
android:name="android.permission.BLUETOOTH_SCAN"
499+
tools:node="replace"/>
482500
```
483501

502+
</td>
503+
</tr>
504+
505+
<tr>
506+
<td>
507+
508+
[Performs background Bluetooth Low Energy scans](https://developer.android.com/training/location/permissions#background)
509+
510+
</td>
511+
<td>
512+
513+
```xml
514+
<uses-permission
515+
android:name="android.permission.ACCESS_BACKGROUND_LOCATION"
516+
android:maxSdkVersion="30"/>
517+
```
518+
519+
</td>
520+
</tr>
521+
522+
<tr>
523+
<td>
524+
525+
[Requires Bluetooth Low Energy (and won't function without it)](https://developer.android.com/guide/topics/connectivity/bluetooth/permissions#features)
526+
527+
</td>
528+
<td>
529+
530+
```xml
531+
<uses-feature
532+
android:name="android.hardware.bluetooth_le"
533+
android:required="true"/>
534+
```
535+
536+
</td>
537+
</tr>
538+
</table>
539+
484540
### Gradle
485541

486542
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.juul.kable/core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.juul.kable/core)

0 commit comments

Comments
 (0)