Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Analyze code with Lint for calls that require permissions

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:

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'

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!

like image 870
JacksOnF1re Avatar asked Jan 14 '16 17:01

JacksOnF1re


1 Answers

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.

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.

like image 148
fractalwrench Avatar answered Sep 27 '22 17:09

fractalwrench