Search code examples
javaandroidsdkandroid-permissionsforeground-service

Is it okay to allow "While Using the App" instead of "ALWAYS ALLOW" while foreground service is used?


Is there any difference between location permission ALWAYS_ALLOW and Only While Using the App option when using foreground service. I'm developing an SDK which use location permission all time, I'm using foreground service and is it okay to allow "Only While Using the App" permission instead of ALWAYS_ALLOW


Solution

  • There is no problem in using the Only While Using the App option, if the location acquisition process in the application will only be performed when the application is open on the screen.

    If you want to get location while in background, you should use ALWAYS_ALLOW option.