What is the appropriate place / approach to request permissions on app launch?

Viewed 35

I have some basic functions in my app that I know will need some permissions pretty much as soon as the app starts, or at least very shortly after. It makes perfect sense to request them on app startup (and I've seen many apps do that, presumably for the same reason). However, I cannot find a suitable place to call requestPermissions. I tried doing that in my Activity.onResume, but that proved to be a very bad idea because for some reason, even when the permission is already granted and there's no prompt pop-up, requestPermissions pauses the activity shortly and resumes it back, so my request causes recursion.

What's the right approach? I don't think onCreate would work, seems a bit early in the life cycle. Or is that indeed the place?

0 Answers
Related