How to check if Android Permission is actually being used?

后端 未结 4 1651
忘掉有多难
忘掉有多难 2020-12-29 01:40


I am maintaining one existing (very-huge, very-sensitive) Android Application.
The other day, I have received an email from my client that, the Application mig

4条回答
  •  既然无缘
    2020-12-29 01:58

    In Android Studio 1.3 & Android Support Library v7:22.2.0, you have solution for it.

    Steps:

    1. Update Android Studio to V1.3
    2. Update your Android Support Library to v7:22.2.0
    3. Run Android Lint (Analyse -> Inspect Code), In Lint Error see for Type "Android -> Constant & Resource Type MisMatch", Which shows all methods which requires permission.

    Explanation

    1. Android has introduced new annotation @requirespermission.
    2. All SDK methods which requires permission are annotated with @requirespermission.
    3. When we call any sdk method which requires permission without properly checking whether we have permission or not, Android studio will through lint error.

提交回复
热议问题