# Ionic 3 Native Geocoder return undefined

**URL:** <https://forum.ionicframework.com/t/ionic-3-native-geocoder-return-undefined/128069>\
**Category:** Ionic Native\
**Created:** [April 16, 2018, 6:22pm UTC](https://forum.ionicframework.com/t/ionic-3-native-geocoder-return-undefined/128069 "2018-04-16T18:22:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ManivannanDurairaj](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@ManivannanDurairaj](https://forum.ionicframework.com/u/ManivannanDurairaj)\
**Post date:** [April 16, 2018, 6:22pm UTC](https://forum.ionicframework.com/t/ionic-3-native-geocoder-return-undefined/128069/1 "2018-04-16T18:22:08Z")

</div>

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. 😢😢

**`Thank you Guys.`**

**My common Provider File:**

```auto
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:-**

```auto
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:**

```auto
"@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: -**

```auto
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

```

---

<div class="post-metadata">

**Author:** ![SurendraSawant](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@SurendraSawant](https://forum.ionicframework.com/u/SurendraSawant)\
**Post date:** [July 17, 2020, 10:34am UTC](https://forum.ionicframework.com/t/ionic-3-native-geocoder-return-undefined/128069/2 "2020-07-17T10:34:41Z")

</div>

Remove Promise from method reverseGeocode(lat: number, lng: number): Promise

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 8:54pm UTC](https://forum.ionicframework.com/t/ionic-3-native-geocoder-return-undefined/128069/3 "2021-07-19T20:54:24Z")

</div>

Closed on July 19, 2021, 8:54pm UTC


