pmwisdom / meteor-background-geolocation-services

Cordova Background Geolocation For Android and iOS with pure javascript callbacks
12 stars 12 forks source link

Remove useless location request on app init #1

Closed danielkalen closed 8 years ago

danielkalen commented 8 years ago

On line ~72 (EOF), you have an empty location request which gets called on startup for no reason which also gets in the way of some developers :)

pmwisdom commented 8 years ago

The reason for that location request is that if you don't fetch at least one point before going in the background permissions will fail and you won't get any data back in the background. How's it getting in the way? I'll remove it / make it a configurable option if theres a case that is bothersome.

danielkalen commented 8 years ago

Got it...

Here's the way it is bothersome for me - the iOS app I'm working on ATM requires the user's location in order to function and since iOS prompts the user to choose whether or not the app should have access to his location without an explanation for what the app will use the user's location for, I want to let the user know what we want to use his location for (for transparency and trust) and then fetch the geolocation upon clicking a CTA button. In addition, to eliminate bugs and optimize functionality the app relies on a localStorage variable to know if the user allowed the use of his location which is set during the aforementioned prompt.

Finally, the app will only use the user's background location if he desires so via an in-app setting which would require the background location polling logic to be activated on-demand. All of the desired functionality I just mentioned goes straight to the garbage if the app requests the user's location on the initial load.

Hope that helps :)

pmwisdom commented 8 years ago

Totally makes sense! I will make it a configurable option.

pmwisdom commented 8 years ago

Alright, you should be able to turn it off now. You may set

`BackgroundLocation.options.fetchLocationOnStart = false;

and it will forego the initial request. Do so before meteor.startup.