Android SDK23查找更新和请求权限的地方 [英] Android sdk23 find places to update and request permission

查看:112
本文介绍了Android SDK23查找更新和请求权限的地方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能是我遗漏了一些东西,但是有没有一种方法可以快速知道我必须使用sdk23进行的Android应用程序所需的新权限检查所要更新的所有位置?

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

危险权限 https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous

编辑

在某些情况下,代码会引发SecurityException,例如在没有授予权限的情况下尝试使用 location 时.但在其他情况下,它只返回空值,如此处

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")

推荐答案

使用Android Studio,打开分析"菜单,然后运行检查代码...".在结果中,打开"Android",然后打开常量和资源类型不匹配".查找以呼叫需要权限..."开头的条目.

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

这篇关于Android SDK23查找更新和请求权限的地方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆