Hi, I can't find any information how to handle bl...
# android
j
Hi, I can't find any information how to handle bluetooth permissions when minsdk is lower than 31. Am I supposed to request coarse location for if sdk is < 31 and otherwise I request BLUETOOTH_SCAN and BLUETOOTH_CONNECT? What about using an annotation such as this?
Copy code
@RequiresPermission(allOf = [
    android.Manifest.permission.BLUETOOTH,
    android.Manifest.permission.BLUETOOTH_ADMIN,
    android.Manifest.permission.ACCESS_COARSE_LOCATION,
])
If I change it to
Copy code
@RequiresPermission(allOf = [
    android.Manifest.permission.BLUETOOTH_SCAN,
    android.Manifest.permission.BLUETOOTH_CONNECT
])
I will get warnings about minSdk. So does this mean I can't use this annotation since the permissions I need are different depending on OS?
not kotlin but kotlin colored 1
f
As far as I know, you will need ACCESS_FINE_LOCATION; As with Bluetooth, using Bluetooth Beacons, you would be able to find the user’s location. I would just ask for all the above permissions to be safe.
This Slack is for questions about the Kotlin programming language, for more Android specific questions, please check other community’s like: https://discord.com/invite/D2cNrqX http://android-united.community/ https://androidchat.co/