Skip to content

Commit

Permalink
Merge branch 'master' into feature/add_expo_plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
intent-kacper-cyranowski authored Oct 17, 2023
2 parents dcbef95 + 1560d5e commit dba51e5
Show file tree
Hide file tree
Showing 69 changed files with 5,256 additions and 1,419 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**/node_modules/*
node_modules/
docs/**
plugin/build
plugin/build
lib/**
126 changes: 0 additions & 126 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [3.0.1] - 2023-10-03

### Changed

- Android permissions section in docs and readme

## [3.0.0] - 2023-09-28

### Added
Expand Down
14 changes: 14 additions & 0 deletions INTRO.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ requestBluetoothPermission = async () => {
}
```

With `neverForLocation` flag active, you can remove `ACCESS_FINE_LOCATION` permissions ask e.g.:

```js
const result = await PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN,
PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT
])

return (
result['android.permission.BLUETOOTH_CONNECT'] === PermissionsAndroid.RESULTS.GRANTED &&
result['android.permission.BLUETOOTH_SCAN'] === PermissionsAndroid.RESULTS.GRANTED
)
```

## Waiting for Powered On state

When iOS application launches BLE stack is not immediately available and we need to check its status.
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ The plugin provides props for extra customization. Every time you change the pro
}
```

1. (Optional) In `AndroidManifest.xml`, add Bluetooth permissions and update `<uses-sdk/>`:
1. In `AndroidManifest.xml`, add Bluetooth permissions and update `<uses-sdk/>`:

```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
Expand All @@ -189,6 +189,23 @@ The plugin provides props for extra customization. Every time you change the pro
...
```

1. (Optional) In SDK 31+ You can remove `ACCESS_FINE_LOCATION` (or mark it as `android:maxSdkVersion="30"` ) from `AndroidManifest.xml` and add `neverForLocation` flag into `BLUETOOTH_SCAN` permissions which says that you will not use location based on scanning eg:

```xml
<uses-permission android:name="android.permission.INTERNET" />
<!-- Android >= 12 -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<!-- Android < 12 -->
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />

...
```

With `neverForLocation` flag active, you no longer need to ask for `ACCESS_FINE_LOCATION` in your app

## Troubleshooting

## Contributions
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ android {
repositories {
mavenCentral()
google()
maven { url 'https://jitpack.io' }
}


Expand All @@ -90,7 +89,8 @@ dependencies {
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation 'com.github.dotintent:MultiPlatformBleAdapter:0.2.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.17'
implementation "com.polidea.rxandroidble2:rxandroidble:1.17.2"
}

if (isNewArchitectureEnabled()) {
Expand Down
19 changes: 18 additions & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bleplx">
package="com.bleplx"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation"
tools:targetApi="s" />
<uses-permission
android:name="android.permission.BLUETOOTH_CONNECT"
tools:targetApi="s" />
</manifest>
3 changes: 1 addition & 2 deletions android/src/main/AndroidManifestNew.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
<manifest></manifest>
Loading

0 comments on commit dba51e5

Please sign in to comment.