@flycoders_sourav wrote:
Native geocoder is not working properly
below my codethis.geolocation.getCurrentPosition().then((resp) => { // resp.coords.latitude // resp.coords.longitude console.log(resp.coords.latitude); console.log(resp.coords.longitude); let options: NativeGeocoderOptions = { useLocale: true, maxResults: 5 }; this.nativeGeocoder.reverseGeocode(resp.coords.latitude,resp.coords.longitude) .then((result: NativeGeocoderReverseResult[]) => alert(JSON.stringify(result[0]))) .catch((error: any) => alert("error"+error)); this.nativeGeocoder.forwardGeocode('Berlin', options) .then((coordinates: NativeGeocoderForwardResult[]) =>alert('The coordinates are latitude=' + coordinates[0].latitude + ' and longitude=' + coordinates[0].longitude)) .catch((error: any) => alert("error"+error)); }).catch((error) => { console.log('Error getting location', error); }); let watch = this.geolocation.watchPosition(); watch.subscribe((data) => { // data can be a set of coordinates, or an error (if an error occurred). // data.coords.latitude // data.coords.longitude });
Please anyone suggest me what I’m wrong.
Thanks
Posts: 1
Participants: 1