Ionic Cordova Geolocation - picks a wrong location first and later picks the correct location

I have been working on my very first Geolocation ionic application. My ionic version is 6.2.1 and the cordova version is 9.0.0.

My question is, when I get the current position using geolocation.getCurrentPosition() it shows a strange behavior. When the getCurrentPosition is invoked for the first time, it usually picks a location which is like 2 km away from my actual location. However, it tends to pick the correct location in usually 5th or 6th(roughly) attempt.

Why is this?

As a workaround for this, I thought of getting the accuracy value, compare it with a threshold, re-pick the location if the accuracy is not enough. This goes until it picks a good enough location.

Is that a good way to achieve what I need? Or is there any way to fix the error in the first place.

Thank you…!