Java

Reduce Runtime Permission Clutter (Headless Dialog Fragments!)

A clean approach to managing runtime permissions

Tyler Roach

4 minute read

I know I’m late to the party implementing Android runtime permissions in the Stream app. We had our reasons for this, but now that Nougat has been released, its time we upgrade our targetSdkVersion to 24. I’m not a huge fan of the design for runtime permissions. It can quickly clutter your activity/fragment code as you have to handle multiple grant scenarios with proper messaging to the user. In order to combat this, I decided to contain nearly all aspects of permission management inside headless dialog fragments.