3

I am using capacitor geolocation plugin to find current location coordinates(latitude and longitude).

const coordinates = await Geolocation.getCurrentPosition({enableHighAccuracy:true});
const center = {lat: coordinates.coords.latitude, lng: coordinates.coords.longitude}; 

But in Iphone its taking around 45sec to 1.5 mins to fetch current location.

I have also used below code. But this is sometime fast sometime slow.

const id = await Geolocation.watchPosition({}, (coordinates, err) => {
                        Geolocation.clearWatch({id});
                        if(err) {
                            console.log(err)
                        }
                        console.log('getCenter ios',coordinates);
                        const center = {lat: coordinates.coords.latitude, 
                                        lng:coordinates.coords.longitude}; 
                    });

Is there any other implementation or free/paid plugin available, which can fetch current location coordinates faster on iphone.

1 Answers1

0

use this code because enable accuracy take some times

const coordinates = await Geolocation.getCurrentPosition();
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 12 '23 at 13:48