transistorsoft / react-native-background-fetch

Periodic callbacks in the background for both IOS and Android
MIT License
1.43k stars 191 forks source link

Which permission to use for background location updates #452

Closed theobouwman closed 11 months ago

theobouwman commented 11 months ago

Should I use the whenInUse or always permission on iOS in order to sync the users location in the background when I use this library ?

christocracy commented 11 months ago

What do you suspect is the difference between the two?

theobouwman commented 11 months ago

Well if I ask for always the option is not shown in the dialog. And I have to manually select it in the settings

christocracy commented 11 months ago

That’s incorrect (for the first request of the permission). I suggest you delete your app and try again.

have you read the api docs Config.locationAuthorizationRequest?

I ask again: what do you suspect is the difference between Always and WhenInUse?

theobouwman commented 11 months ago

@christocracy we need to periodically update the users location. According to different sources I read, the Always option best suits our needs. But as I read in another issue where you stated that this library will not fire events when the app is terminated I do not really know if this plugin can accomplish what we need. We need to start, at the beginning of the day, to sync the user's location with our API every 15-30 minutes, even if the user did not start the app in the morning. Is this possible?

Here I have also added a screenshot of the permission dialog when I asked for the Always permission: image

And this is what I see if I close the app, not terminate it: image

christocracy commented 11 months ago

What a second...why are you posting this at the background-fetch repo? This is a background-geolocation question.

Repost this at the correct repo. And DON'T ignore the issue template there. Including the Config you're providing the .ready(config) method.