How do I request permission for my location (api 23>) when I want to access the location inside a service?
I have a service running every minute fetching data from a URL. In this service I want to pass my location in the URL but I have issues requesting the permission for my location (since you cant do that inside a service). How can I request permission in my MainActivity
?
EDIT: I think my problem is requesting permissions inside a service. My service is started with alarmManager
(setRepeating), and in this service I want to access my real time location. When I try to request permission there it does not work. Can I request permissions elsewhere?