First, the question:
Previously written an Android 4.4 application, used to connect Bluetooth ble, and now take out with the new as compiled (the SDK is 6.0, the phone is also 6.0) the application does not search for Bluetooth, view log always reported permission error:
Need Access_coarse_location or access_fine_location permission ...
Second, the solution process:
However, I put the corresponding permission to join Manifest.xml still reported this error, and finally found this information:
Http://www.open-open.com/lib/view/open1445671646351.html
Explain that I use the 6.0 compilation may be the problem, see the following compatible with the previous version, the SDK manage download a 5.0SDK,
and modify the Build.gradle file:
After compiling the run without error, but still do not search Bluetooth device, and then found on 6.0 system Bluetooth service and location services are open to search !
So open the location service on the phone, you can search!
Third, reflection
And a partner who is currently engaged in Android discussion, he "hindsight" to say 6.0 permissions and before the very different ~ then I searched another article about 6.0 permissions--
http://jijiaxin89.com/2015/08/30/Android-s-Runtime-Permission/
Confirmed the previous idea. It is true that Android is very fast, I sometimes play only to make two, usually do not follow the technology trend of Android, so this wonderful problem will let us these on the Android technology people are not easy to prevent. The people who encounter the same problem on the Internet are also many, but the answer is very shallow (only let you add permission in the manifest), so here the solution to share, only for posterity reference!
[Exception resolution] Android 6.0 permissions issue causes the old Bluetooth program to appear unusual solution: Need Access_coarse_location or access_fine_location permission ...