# Cordova-plugin-geolocation location access prompt appears twice

**URL:** <https://forum.ionicframework.com/t/cordova-plugin-geolocation-location-access-prompt-appears-twice/69357>\
**Category:** ionic-v3\
**Created:** [November 7, 2016, 4:11am UTC](https://forum.ionicframework.com/t/cordova-plugin-geolocation-location-access-prompt-appears-twice/69357 "2016-11-07T04:11:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![philipbrack](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@philipbrack](https://forum.ionicframework.com/u/philipbrack)\
**Post date:** [November 7, 2016, 4:11am UTC](https://forum.ionicframework.com/t/cordova-plugin-geolocation-location-access-prompt-appears-twice/69357/1 "2016-11-07T04:11:10Z")

</div>

Hello, I am seeing an issue where I am getting the request to access location information twice in my app. Can someone help me.

Image 1

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/e/e/ee1eccd0579694426d767b7a3d22fafd712449f0.PNG)

Image 2

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/5/0/509cacced8db0ee8d65579cbe2e891287dee710b.PNG)

People on Stack Overflow have suggested that I need to make sure ionic has loaded. I do this and I still get this issue. Who has seen this and knows how to address it? FYI I am using ionic native API call-

`Geolocation.getCurrentPosition({timeout: 20000, enableHighAccuracy: false})`

## ionic info

* * *

```
Your system information:

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.1
Ionic App Lib Version: 2.1.1
Ionic App Scripts Version: 0.0.39
ios-deploy version: Not installed
ios-sim version: 5.0.8
OS: Mac OS X Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.1 Build version 8B62
```

---

<div class="post-metadata">

**Author:** ![philipbrack](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@philipbrack](https://forum.ionicframework.com/u/philipbrack)\
**Post date:** [November 7, 2016, 4:40am UTC](https://forum.ionicframework.com/t/cordova-plugin-geolocation-location-access-prompt-appears-twice/69357/2 "2016-11-07T04:40:46Z")

</div>

So I have it working now.

This works for ios-  
cordova plugin add [https://github.com/apache/cordova-plugin-geolocation.git](https://github.com/apache/cordova-plugin-geolocation.git) --variable GEOLOCATION\_USAGE\_DESCRIPTION=“I would like to show you information near you”

so I thought the problem may be related to the normal plugin, so I added “cordova-plugin-geolocation” to packages.json and did ionic state reset and it works again.

I am not sure what it was in the end.

---

<div class="post-metadata">

**Author:** ![spogburn](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/spogburn/32/106886_2.png) [@spogburn](https://forum.ionicframework.com/u/spogburn)\
**Post date:** [February 28, 2017, 6:55pm UTC](https://forum.ionicframework.com/t/cordova-plugin-geolocation-location-access-prompt-appears-twice/69357/3 "2017-02-28T18:55:26Z")

</div>

I’m having this same problem, haven’t solved it yet. I’ve added cordova-plugin-geolocation to the package.json because it was odd to me it doesn’t get in there when you install it, even with a --save flag. I’d done a state reset both with and without that in the package.json and that hasn’t solved it either…

---

<div class="post-metadata">

**Author:** ![spogburn](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/spogburn/32/106886_2.png) [@spogburn](https://forum.ionicframework.com/u/spogburn)\
**Post date:** [March 1, 2017, 4:42pm UTC](https://forum.ionicframework.com/t/cordova-plugin-geolocation-location-access-prompt-appears-twice/69357/4 "2017-03-01T16:42:52Z")

</div>

I solved this by putting the geolocation code inside the platform ready block on the app.component.ts.

I had mistakenly assumed that having it inside a child component would mean the platform was ready, but apparently this was not the case.

---

<div class="post-metadata">

**Author:** ![Sylvinrodz](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@Sylvinrodz](https://forum.ionicframework.com/u/Sylvinrodz)\
**Post date:** [November 22, 2018, 12:37pm UTC](https://forum.ionicframework.com/t/cordova-plugin-geolocation-location-access-prompt-appears-twice/69357/5 "2018-11-22T12:37:51Z")

</div>

put you geolocation code inside platform.ready()

```auto
this.platform.ready().then(() => {
  this.geolocation.getCurrentPosition().then((resp) => {
      console.log(resp.coords.latitude);
      console.log(resp.coords.longitude);

})

```

---

<div class="post-metadata">

**Author:** ![cagb80](https://avatars.discourse-cdn.com/v4/letter/c/3be4f8/32.png) [@cagb80](https://forum.ionicframework.com/u/cagb80)\
**Post date:** [May 31, 2019, 6:56pm UTC](https://forum.ionicframework.com/t/cordova-plugin-geolocation-location-access-prompt-appears-twice/69357/6 "2019-05-31T18:56:51Z")

</div>

TY this is the correct solution for Ionic 3
