分析code皮棉为需要调用的权限 [英] Analyze code with Lint for calls that require permissions

查看:911
本文介绍了分析code皮棉为需要调用的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是我targetSdkVersion设置为23,所以我想实现
请求在运行时的权限。 (请参见这里

I am setting my targetSdkVersion to 23 and therefore I want to implement "Requesting permissions at runtime". (see here)

皮棉直接调用出来,如果​​你忘了检查和许可
告诉你以下内容:

Lint directly calls out if you forget to check the permission and tells you the following:

呼叫需要可由用户被拒绝权限:code必须
  明确检查是否许可​​可用(与
  的checkPermission )或明确处理潜力
  `SecurityException异常

Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential `SecurityException'

这是相当不错的,我想分析一下我的code任何电话,我可能
都忘记了,但是我找不到我必须选择林特选项
在我检查的个人资料。

This is quite nice and I want to analyze my code for any call that I may have forgotten, but I can't find Lint option that I have to select in my Inspection profile.

怎么叫的检查?
谢谢!

How is the inspection called? Thanks!

推荐答案

在赫克托首先单击督察(有胡子的男人在Android Studio中的最右下角的小图标)。这将打开一个选项配置检查。

First click on Hector the Inspector (the small icon of a man with a moustache at the very bottom-right of Android Studio). This will bring up an option to Configure inspections.

您应该然后键入权限到搜索栏,并确保常数和资源的类型不匹配被选中。在此之后,它是通过运行分析检查的一个简单的例子>检查code。

You should then type 'Permissions' into the searchbar, and ensure that "Constant and Resource Type Mismatches" is checked. After that, it's a simple case of running an inspection via Analyse > Inspect Code.

这篇关于分析code皮棉为需要调用的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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