Android sdk23 find places to update and request permission

时光毁灭记忆、已成空白 提交于 2019-12-22 00:39:54

问题


May be I am missing something, but is there a way to quickly know all the places I have to update with the new permission checks needed for Android apps using sdk23?

As a developer this change is very frustrating considering the multiple places that need to be updated. I would like to make sure I don't forget/miss any of them.

I am talking about finding where it will be needed to use these two functions before using the permissions qualified as 'Dangerous'

ContextCompat.checkSelfPermission()
ActivityCompat.requestPermissions()

https://developer.android.com/training/permissions/requesting.html

Dangerous permissions https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous

EDIT

In some cases the code throws SecurityException like when trying to use location without the granted permission. But in other cases it just returns null like here

AccountManager.get(context).getAccountsByType("com.google")

回答1:


Using Android Studio, open the Analyze menu and run Inspect Code... In the results, open Android and then Constant and Resource Type Mismatches. Look for entries that start with "Call requires permission..."



来源:https://stackoverflow.com/questions/35965770/android-sdk23-find-places-to-update-and-request-permission

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!