0

I am planning to develop a Hybrid App, where I need to allow the user to do certain action based on 100 radius within current latitude and longitude.

I don't what to keep on tracking user current location like what this link explains about https://ionicframework.com/docs/native/background-geolocation/.

I need to allow the user if and only if the user within the specified radius.

ASKAR ALI
  • 643
  • 1
  • 5
  • 18

2 Answers2

0

You can get distance between user location and your store location, then if distance is less then 100 then you can call function to enable service you want for user.

You can check below link to get code for distance calculation

Function to calculate distance between two coordinates shows wrong

0

Use Ionic Native Geolocation Plugin to get user location using getCurrentPosition() then calculate distance between user and store and check if it's within the required radius or not.

The easiest way to calculate distance between two coordinates is by using Ionic Native Google Maps Plugin. Use computeDistanceBetween(locationA, locationB) static method of the Spherical static class.