Wiqaytna-app / wiqaytna_android

GNU General Public License v3.0
161 stars 65 forks source link

Bluetooth LE will fail in Android 10/ API 29 and above. #9

Closed Lekssays closed 4 years ago

Lekssays commented 4 years ago

From the Android 10 documentation, a new permission ACCESS_BACKGROUND_LOCATION is needed if an app using Bluetooth wants to run in the background https://developer.android.com/about/versions/10/privacy/changes#location-telephony-bluetooth-wifi.

From the AndroidManifest.xml file of the application, only the following permissions are requested for the application to run: `

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

`

However, for Android 10 / API 29 and above, <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> is also needed. You can check reference here: https://stackoverflow.com/questions/32708374/bluetooth-le-scan-doesnt-work-on-android-m-in-the-background

DouiriAli commented 4 years ago

ACCESS_BACKGROUND_LOCATION is available from API 29 or higher, but the compileSdkVersion of the wiqaytna_android project is 28, no need to use ACCESS_BACKGROUND_LOCATION, the system automatically add this permissionn during installation.

Check reference : https://developer.android.com/about/versions/10/privacy/changes

See the project build configuration file : https://github.com/Wiqaytna-app/wiqaytna_android/blob/master/app/build.gradle