After the update (Android 6) my nexus 5, my running application not able to scan(find) the any bluetooth device. getBondedDevices() to get paired devices list working fine.
I have also test many sample code and application (I have put link below) of bluetooth functionality. all have the same problem, it's not able to find the bluetooth device.
But yes I have found only one application on play store which is working and it able to discover/scan the bluetooth device.
Not working apps on Android 6 (Nexus 5) I have tested many app like, bluetrem, sample code by Android Developer and many more.
Working app Bluetooth 4.0 Scanner https://play.google.com/store/apps/details?id=com.bluemotionlabs.bluescan
Is Any one know what is the problem, is there any changes required on code to make compatible with Android 6
At least in Android 6.0 November 1, 2015 security patch, you not only need ACCESS_FINE_LOCATION
or ACCESS_COARSE_LOCATION
permissions but also need the location service actually turned on in order for Bluetooth scan to work.
I verified this in my app and a bunch of other BLE apps in Play Store, including Bluetooth 4.0 Scanner.
This means we have to make sure location is on before starting a scan, otherwise it will fail silently.
It works, this is a solution, try to turn on GPS after put ACCESS_FILE_LOCATION or ACCESS_COARSE_LOCATION and after ask the runtime permission
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With