[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 ...

Source: Internet
Author: User

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 ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.