How to grand runtime permissions with out requestPermissions() API

91 Views Asked by At

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?

1

There are 1 best solutions below

2
On BEST ANSWER

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.