Ionic 3 Native Geocoder return undefined


#1

Hi Guys,
Am used native geocoder plugin for “reverseGeocode()” method but am getting “undefined” error. So, Guys please help me. How to resolve this issue.

Below i will give all the details,

Guys, I have a app delivery for this week, So kindly help to resolve this issue. :cry::cry:

Thank you Guys.

My common Provider File:

reverseGeocode(lat: number, lng: number): Promise<any> {
    return new Promise((resolve, reject) => {
      this.nativeGeocoder.reverseGeocode(lat, lng)
        .then((result: NativeGeocoderReverseResult) => {
          let str: string = `The reverseGeocode address is ${result.countryName} in ${result.countryCode}`;
          resolve(str);
        })
        .catch((error: any) => {
          reject(error);
        });
    });
  }

My Main Class file:-

this.watch = this.geo.watchAndLocate().subscribe(position => {
      this.zone.run(() => {
        this.lat = position.coords.latitude;
        this.long = position.coords.longitude;
        this.latt = position.coords.altitude;
        this.accu = position.coords.accuracy;
        this.geo.reverseGeocode(this.lat, this.long).then(res => {
          this.zone.run(() => {
            // alert(res.countryCode);
            this.country = res.countryName;
            alert(this.country);
          });
        })
      });
    })

App Package.json:

"@ionic-native/geolocation": "^4.7.0",
    "@ionic-native/location-accuracy": "^4.7.0",
    "@ionic-native/native-geocoder": "^4.7.0",
    "@ionic-native/splash-screen": "4.6.0",
    "@ionic-native/status-bar": "4.6.0",
    "@ionic/storage": "2.1.3",
    "@types/google-maps": "^3.2.0",
    "cordova-android": "7.0.0",
    "cordova-plugin-device": "^2.0.1",
    "cordova-plugin-geolocation": "^4.0.1",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^1.2.0",
    "cordova-plugin-mauron85-background-geolocation": "^2.3.5",
    "cordova-plugin-nativegeocoder": "^3.1.1",

Ionic Info: -

cli packages: (C:\Users\DuraiMalar\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 25.2.5
    Node              : v9.11.1
    npm               : 5.3.0
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:\Users\DuraiMalar\AppData\Local\Android\sdk

Misc:

    backend : pro