I am trying to open google map app by giving coordinates of start and end point for the start point I need to get current position of user which comes with promise function getCurrentLocation() which problem is when I try to open app inside this promise function it cant be open but I can not get those current coordinats outside of that promise function
let lat = 0;
let long = 0;
await navigator.geolocation.getCurrentPosition((position)=>{
lat = position.coords.latitude;
long = position.coords.longitude;
let options = {
start: `${lat},${long}`,
app: LaunchNavigator.APP.GOOGLE_MAPS
}
LaunchNavigator.navigate([address.latitude, address.longitude], options)
.then(
success => console.log('Launched navigator',success),
error => console.log('Error launching navigator', error)
);
});