cancel
Showing results for 
Search instead for 
Did you mean: 

Please help me I have been stuck for months trying to get a toast to pop up using location

StacksIndeed
Explorer
0 Kudos
175

Basically I have it set up now where it will display the users coordinates when you push a button. Id like to have it so that when the users coordinates are being updated all the time (I downloaded the location polling GPS function from the marketplace) but I do not know how to make a pop up or a toast appear when the user is at a certain location. Id like to start with something simple like when they are about 20 meters away from a good restaurant in town. 

I have it so that when i push a button it shows my coordinates, but I dont understand how to compare those to the coordinates of a place in town. I have been reading the learning journys and watching videos. Iv been trying everything for so long now im getting really discouraged. 

I have Variables set up to get the users lat and longitude data, I also have set app variables to store the Hotel coordinates but i dont understand what im doing wrong. 

Screen shots below

StacksIndeed_0-1725245288848.png

I am a software developer, learning still clearly lol. Im surprised that I find I'm getting closer using Kotlin and android studio than I am using this supposedly easier method.

View Entire Topic
Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

With the polling, you can create 2 page variables:

  • polling - true/false
  • currentLocation, an object with lat and lon text fields

Then create buttons to start and stop polling and o display the latitude and longitude values.

Dan_Wroblewski_1-1725353253368.png

Then you can create a simple logic flow:

Dan_Wroblewski_0-1725353104665.png

  1. Start polling
  2. Set indicator to start regularly getting location values
  3. Set up a loop (Delay)
  4. Each time get the latest geolocation values, and put in your variable.
  5. If we are still polling, go around again.

The other button stops the polling.

You might want to check out the great challenge @eshrinivasan published recently that dealt with location services: https://community.sap.com/t5/sap-builders-discussions/april-citizen-developer-challenge-sap-build-ap...