Retrieve location on startup

Hey community I was wondering if there is a possibility to retrieve to latitude & longitude from the geolocation widget ( or any other for that matter ) when the app starts ( or could be called through a microservice) . I want to add a the location to a report without user interaction. Is there a tutorial available for this matter ?    Kind regards 
5 answers

We do this with a combination of the Geolocation widget, and a JavaScript snippet which mimics a click on the Geolocation's "Get Location" button



So the Geolocation Widget has the BackgroundGPS class. And has an on change microflow to save the coordinates (and get an actual Geocoded location)


What do you mean with "when the app starts"? Do you need the geolocation of the server the application is running on?


No I need the location of the user posting a report. Without the user having to click a button.

So best scenario is:

User starts up the app -> click button “report” -> user fills in comment ( Location is retrieved automatically) -> User gets overview of the report (with location pinned to a map) -> user submits the report


Hey Mickaël, 

If the Geolocation is a widget it is client-side code. Which means the user must provide input. 

Unless you decide to refactor the Geolocation widget for your specific need (javascript).
Which means you will make it push it's Geolocation data to the Mx database as soon as the page loads.
After you press "report" it will retrieve the location from your Mx database rather then client side widget that wants input first. 

I'll be honest, I'm not familiar with the Geolocation widget, but this seems like the best way. 



This Is very helpful.

Thank you very much to everyone for the effort.


Kind regards