androidandroid-manifestruntime-permissions

How to grand runtime permissions with out requestPermissions() API


I would like to access "ACCESS_FINE_LOCATION" permission in a service. The problem is as Service doesn't have UI, I can't show runtime dialog to user to allow runtime permission. My question, is there a way to access this permission without asking runtime permission dialog?


Solution

  • My question, is there a way to access this permission without asking runtime permission dialog?

    Fortunately, no, for privacy and security reasons.

    I can't show runtime dialog to user to allow runtime permission

    Request the runtime permission from your UI before starting the service. Or, have the service display a Notification that can start your UI and request the permission.