I have an ecommerce website and ecommerce app. We sells different products. What I want to do is like Uber or grab app that can track real time location of the taxi going to my location.
So in my app, every time the delivery boy delivers the product to the customer, the delivery boy will see the exact location and direction of his destination. The same as the customer, he/she can see the exact location of the delivery boy. Is it possible to do in React native app and website?
This is actually much easier nowadays, with react-native-maps only, by leveraging the watchPosition observer:
navigator.geolocation.watchPosition(
position => {
console.log(position);
const { latitude, longitude } = position.coords;
this.setState({ latitude,longitude
},
error => console.log(error),
{
enableHighAccuracy: true,
timeout: 20000,
maximumAge: 1000,
distanceFilter: 10
}
);
Here's a great detailed tutorial on how to achieve location tracking in React Native.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With