Exhaustive list of Android SDK methods that require Runtime Permission Check.

The problem

We’ve recently added support of Runtime Permissions. Some of the places where we had to handle them were shown by lint, but not everything is shown by lint. For example, calling Camera.open() also causes SecurityException if user haven’t granted Camera Permission, and lint didn’t show us this “dangerous” method.

Going through whole 200K lines of code and searching for places where we could crash with SecurityException became real pain.

Permissions Reference

We had an idea that it would be great if Google would give us exhaustive list of methods which require requesting permission from user, but that didn’t happen.

We thought that other developers probably also face this problem when implementing Runtime Permission. So we decided to create the list ourselves:


PermissionsReference — its a project with which we (Android developers) can make our life easier.


Currently it doesn’t contains a list of all methods which require Runtime Permission check, so the list is not exhaustive. Yet. But we believe that with help of other developers we can fulfil the list very fast.

Project also contains a sample application that demonstrates how Runtime Permission check works with every specific method. You can choose two options:

  • Crash — the application will call “dangerous” method without asking the permission. It will lead to SecurityException.
  • Ask Permission — the application will do the Runtime Permission check before calling “dangerous” method.

Let make our life better. We encourage everyone to contribute to the project.

PermissionsReference

Cheers :)