## How I solved it: ### For Permissions: Make sure to request Background location too: ```Java <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
For Verifying Permissions:
Copy the whole snippet from: https://altbeacon.github.io/android-beacon-library/requesting_permission.html to your on create method
BE PATIENT!!!!
Apparently, it takes about 1 minute for the first detection (both monitoring and ranging) to occur despite me setting the ranging time to 5 seconds (5000 ms). After that, the response time for out of range beacon should be less than half a second.
Please Advice if you can help with the long waiting time between starting the monitoring to receiving a list of beacons detected despite a change in beacon detection state already within 1 second of starting monitoring.
Original Question
Extra Detail: The detection goes smoothly even if the 'Change Bluetooth Permission' mentioned above is set to 'notify' whenever I switch to another app despite the app not being a service. Why is that?
Original Question: I am trying to scan for beacons around me using the android beacons library and it never works unless I manually go into settings -> manage apps and change the 'Change Bluetooth Connectivity (turn Bluetooth on or off)' permission from 'notify' -> to 'Accept'
However, I already requested bluetooth and bluetooth admin permissions
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
as well as other permissions like fine location/coarse location
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
The previous app that I created worked fine on my device but in that app, the beacon functions are built as a 'service' and I have heard that requesting Location permission when running beacon functions not as a service can spell disaster. However, removing the location permissions did not make a difference upon my experimentation. It is only manually changing the bluetooth permission in settings that made it work.
So the question is, how to I force the general bluetooth permission on a Xiaomi phone to ACCEPT through a prompt like requesting dangerous permissions for coarse location requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1234);
and is this the right way to solve the issue? Many thanks
Device: Xiaomi Mi8 (MIUI11 Android 10 API29)```