23
Views
4
Comments
Solved
Fetch current location & cal. the distance between the destinations every 2 mins.
Question
Application Type
Mobile

Hello People,

My expectation is to fetch the current location of the user and calculate the distance between the current location and the destination location every 2 minutes.

I've already referred this Forum Link but doesn't help, Kindly help me with this issue.

Thanks in Advance,
Nandhakumar S.

Solution

Hi,

You could do this using the Location plugin from OutSytems, This has a Watch function, and by checking if the last location and the new location are more than 2 minutes apart you could update the distance.  See my OML for my version on how I did it

LocationTracking.oml

Hello,

Here's an example with one possible way of implementing this. It uses the Location Plugin from the Forge to calculate the distance between the device's position and the destination latitude/longitude every 10 seconds. I've used Amsterdam's Rijksmuseum's coordinates as the default destination.

You can, of course, change the destination coordinates and the time interval to suit your needs.

SandboxMobile.oml
Champion

Hi

You can fetch the current location using location plugin. Now to fetch the distance you can use Google api. But it's paid on usage basis. But if you want to calculate direct distance ( displacement) between 2 points can use mathematical formula. But if you want to calculate the route distance then need to call an API for this.

Regards 

Solution

Hi,

You could do this using the Location plugin from OutSytems, This has a Watch function, and by checking if the last location and the new location are more than 2 minutes apart you could update the distance.  See my OML for my version on how I did it

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