# Google-maps geolocation

**URL:** <https://forum.ionicframework.com/t/google-maps-geolocation/2576>\
**Category:** ionic-v1\
**Created:** [April 3, 2014, 1:41am UTC](https://forum.ionicframework.com/t/google-maps-geolocation/2576 "2014-04-03T01:41:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ns01](https://avatars.discourse-cdn.com/v4/letter/n/e9a140/32.png) [@ns01](https://forum.ionicframework.com/u/ns01)\
**Post date:** [April 3, 2014, 1:41am UTC](https://forum.ionicframework.com/t/google-maps-geolocation/2576/1 "2014-04-03T01:41:18Z")

</div>

Hi,  
I’m making an application that uses Google Maps.  
App works fine in the browser, but Android device doesn’t  
allow me to use geolocation.  
Does anyone know what the problem is?

---

<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:** [April 3, 2014, 1:49am UTC](https://forum.ionicframework.com/t/google-maps-geolocation/2576/2 "2014-04-03T01:49:53Z")

</div>

There should be some permissions that you have to include in your android.manifest file.  
Here’s an article from google about setting up the maps api. Basically your looking for the references to the mainfest file

---

<div class="post-metadata">

**Author:** ![ShinyArmor](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@ShinyArmor](https://forum.ionicframework.com/u/ShinyArmor)\
**Post date:** [April 3, 2014, 8:21am UTC](https://forum.ionicframework.com/t/google-maps-geolocation/2576/3 "2014-04-03T08:21:22Z")

</div>

@ns01 did you install geolocation plugin for cordova/phonegap?

---

<div class="post-metadata">

**Author:** ![ns01](https://avatars.discourse-cdn.com/v4/letter/n/e9a140/32.png) [@ns01](https://forum.ionicframework.com/u/ns01)\
**Post date:** [April 3, 2014, 3:19pm UTC](https://forum.ionicframework.com/t/google-maps-geolocation/2576/4 "2014-04-03T15:19:47Z")

</div>

Ok. I have included permissions in AndroidManifest.xml and config.xml  
but it still does not work.  
I use [build.phonegap.com](http://build.phonegap.com) to build my app. Can that be a mistake?  
Do you know some good tutorial “How to build android app with ionic step by step” ?

---

<div class="post-metadata">

**Author:** ![abmcr](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@abmcr](https://forum.ionicframework.com/u/abmcr)\
**Post date:** [June 15, 2014, 2:25pm UTC](https://forum.ionicframework.com/t/google-maps-geolocation/2576/5 "2014-06-15T14:25:14Z")

</div>

I also have some problem with geolocation; i have try the new ng-cordova.js, the i have installed the cordova geolocation plugin.  
My controller is very simple (and it work fine in Chrome)

> .controller(‘DashCtrl’, function($scope,$cordovaGeolocation) {  
> $cordovaGeolocation.watchPosition().then(function (resp) {  
> }, function (err) {  
> }, function (position) {  
> $scope.lat = position.coords.latitude;  
> $scope.lng = position.coords.longitude;  
> });

> ```
> $scope.getLatLng = function () {
> if (!$scope.lat && !$scope.lng) {
> return '???';
> }
> return $scope.lat.toFixed(3) + ', ' + $scope.lng.toFixed(3);
> }
> 
> ```
> 
> });

(Installing “org.apache.cordova.geolocation” for android); all work fine into the web browser, but in a device simulator not work.  
When i have run ionic build android, the scrpt has made the permission in the android.manifest.xml: these are the line added

```
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

```

but in the device (i use genymotion) the controller for getting the coords don’t work…  
Thank you

---

<div class="post-metadata">

**Author:** ![Ohayo](https://avatars.discourse-cdn.com/v4/letter/o/96bed5/32.png) [@Ohayo](https://forum.ionicframework.com/u/Ohayo)\
**Post date:** [July 2, 2014, 6:46am UTC](https://forum.ionicframework.com/t/google-maps-geolocation/2576/6 "2014-07-02T06:46:35Z")

</div>

abmcr :

I am testing with genymotion too and after updating config.xml and AndroidManifest.xml as found on different forums, I realized that the gps was not ON in the emulator when using genymotion… just switched ON and it worked.

---

<div class="post-metadata">

**Author:** ![sjerd](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sjerd/32/7491_2.png) [@sjerd](https://forum.ionicframework.com/u/sjerd)\
**Post date:** [July 2, 2014, 10:20am UTC](https://forum.ionicframework.com/t/google-maps-geolocation/2576/7 "2014-07-02T10:20:35Z")

</div>

Try adding geolocation plugin with the nodejs command line

```
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git

```

$ stands for the directory in which your app is developed
