[Interest] Android 6.0 breaks Qt Bluetooth and requires check for dangerous permissions at run time?

Edward Sutton edward.sutton at subsite.com
Thu Apr 14 19:59:03 CEST 2016


Adding ACCESS_COARSE_LOCATION to my AndroidManifest seemed to restore Bluetooth functionality.

Does Qt 5.5 somehow take care of checking Android permissions for me?


Location permissions are considered “Dangerous Permissions”  and the following article states the app needs to check whether it has the permissions every time it runs.   A user can deny a permission if he chooses.


http://developer.android.com/intl/in/guide/topics/security/permissions.html#normal-dangerous


  *   If the device is running Android 6.0 (API level 23) or higher, and the app's targetSdkVersion<http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#target> is 23 or higher, the app requests permissions from the user at run-time. The user can revoke the permissions at any time, so the app needs to check whether it has the permissions every time it runs. For more information about requesting permissions in your app, see the Working with System Permissions<http://developer.android.com/training/permissions/index.html> training guide.

http://developer.android.com/intl/in/training/permissions/requesting.html

Check For Permissions

________________________________

If your app needs a dangerous permission, you must check whether you have that permission every time you perform an operation that requires that permission. The user is always free to revoke the permission, so even if the app used the camera yesterday, it can't assume it still has that permission today.

To check if you have a permission, call the ContextCompat.checkSelfPermission()<http://developer.android.com/reference/android/support/v4/content/ContextCompat.html#checkSelfPermission(android.content.Context,%20java.lang.String)> method. For example, this snippet shows how to check if the activity has permission to write to the calendar:

// Assume thisActivity is the current activity
int permissionCheck = ContextCompat.checkSelfPermission(thisActivity,
        Manifest.permission.WRITE_CALENDAR);

If the app has the permission, the method returns PackageManager.PERMISSION_GRANTED<http://developer.android.com/reference/android/content/pm/PackageManager.html#PERMISSION_GRANTED>, and the app can proceed with the operation. If the app does not have the permission, the method returns PERMISSION_DENIED<http://developer.android.com/reference/android/content/pm/PackageManager.html#PERMISSION_DENIED>, and the app has to explicitly ask the user for permission.



Does Qt do the ContextCompat.checkSelfPermission?  Or do I need a JNI to call this?


-Ed



This email and any files transmitted with it from The Charles Machine Works, Inc. are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the sender. Our company accepts no liability for the contents of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160414/4562869a/attachment.html>


More information about the Interest mailing list