Hi there,
I see some strange behaviour here when using Bluetooth with Android in the background.
I'm using the permissions
BLUETOOTH , BLUETOOTH_ADMIN, ACCESS_COARSE_LOCATION , ACCESS_FINE_LOCATION
and there is the new permission ACCESS_BACKGROUND_LOCATION
Currently I do not really use lcation at all, only in combination with Bluetooth LE, which requires that.
Since I want to use Bluetooth in the background, it seems that I have to set the ACCESS_BACKGROUND_LOCATIONas well.
Usually all works well, but I can see a strange effect after first install:
Only when the app is first time installled,
- I see the first permission alert popping up, and
- usually I set location permission to ALWAYS
- If I check the system permission dialog, I can see that location ALWAYS is perfectly set in the Android system
- ! But Bluetooth LE its NOT working.
Only after that I do,
- close the app (closing not really needed, also good enough to change the system permission dialog to "WHEN IN USE")
- change the location permission to "WHEN IN USE"
- open or start the app again
- ! opening, after changing the permission, will re-start the app, which is same as close/open
So that really close/open is not needed, the system permission change causes the same effect.
! Changing from "WHEN IN USE" to "ALWAYS" doesn't re-start the app.
- the app is asking again for location "ALWAYS", as it should
- when I set "ALWAYS" (the second time), only then Bluetooth LE is working
Conclusions:
- So seems to work only from the 2nd time setting "ALWAYS", permission needs to be switched to "WHEN IN USE" once before.
- I can also install the app, set permission alert to "WHEN IN USE", and then in system dialog change from "WHEN IN USE" to always,
the app doesn't re-start, but seems to work with Bluetooth now.
- It needs a sequence with "WHEN IN USE" firstly be required, before switching to "ALWAYS", is that the case ?
Any clues what the real reason for this odd behaviour might be ?