Is there an easy way to identify all the API calls an Android app makes that need to be adapted to use runtime permissions in Android M (6, API 23)?
It appears that you just have to figure it out by testing, trial & error, or expert knowledge (eg: pouring over the API docs and your source code). I expected that Google would release a migration tool, but I haven't seen any evidence of that. Not doing so looks as though it will leave your apps vulnerable to runtime crashes if anyone disables access to a permission post-install, even if you aren't using the runtime permission tags in your manifest.
What are the best practices for migrating to runtime permissions?
checkSelfPermission(String perm); It returns an integer value of PERMISSION_GRANTED or PERMISSION_DENIED. Note: If a user declines a permission that is critical in the app, then shouldShowRequestPermissionRationale(String permission); is used to describe the user the need for the permission.
Runtime permissions cover areas where the app wants data or resources that involve the user's private information, or could potentially affect the user's stored data or the operation of other applications. For example, the ability to read the user's contacts, external storage, or location are runtime permissions.
The method shouldShowRequestPermissionRationale() can be used to check whether the user selected the 'never asked again' option and denied the permission.
PERMISSION_GRANTED or PackageManager. PERMISSION_DENIED. Run the app on a device or emulator running a version of Android that predates Android 6.0 and check the log cat output within Android Studio. After the app has launched, the Logcat output should include the “Permission to record denied” message.
I wasn't able to find any existing tools, so our team at Galois adapted a static analysis tool we created over the past ~4 years to identify permission-protected method calls in binary Android apps.
You can use it at:
There are more details here:
http://galois.com/blog/2015/10/fuse-analyzer-handling-runtime-permissions-android-6-0/
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