[Location Plugin] Location default when user opts out of GPS Permissions
Forge component by OutSystems R&D
Application Type
Mobile

Hello OutSystems Community, 

New to OutSystems here. I'm building a mobile app with the following desired behavior:

User clicks button -> Pop up screen asks user to allow the app to record their location. 

If No, I want to define a default location. The user is redirected to the next page with a map that shows the default location

If yes, the user's geo coordinates are recorded. The user is redirected to the next page with a map of their location. 


I'm having trouble figuring out how to create this user flow with the logic that I outlined. Are there any kind souls that can offer some direction? Thank you! 

Solution

Hi,

You can try these steps to see if they help you:

  • You can declare 3 local variables: Latitude (decimal), Longitude (decimal) and ShowPopup (boolean).
  • The Latitude and Longitude local variables have the default location.
  • Then, you can add a popup widget and use the local variable ShowPopup to show/hide popup (property Show Popup).
  • In this popup widget, you can add 2 buttons: Yes or No.
  • The No button will have an OnClick event with the logic to hide popup (ShowPopup=false) and redirect to the next page (end with destination). 
  • The Yes button will have an OnClick event with this logic (or similar). You need the LocationPlugin.

  • The next page must have 2 input parameters (latitude and longitude) and must fill with local variables (latitude and longitude).
  • The next page needs the OutSystemsMaps to show a map. This map will show the location using the latitude and longitude in input parameteres (Latitude+","+Longitude).

Kind regards, David.

David, 

Thank you so much!!! This is exactly the answer that I was looking for. 

Cheers, 

Amee 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.