我是我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.