Geolocation: '' Would like to use your current location

I know there’s a similar post about this, but the owner got it working just by reinstalling the plugin, which didn’t work for me.
Here’s what I did:

ionic start mySecondApp tabs
cd mySecondApp
ionic platform add ios
cordova plugin add org.apache.cordova.geolocation
vim www/js/controller.js

**Insert this code at DashCtrl: **

.controller('DashCtrl', function($scope) {

  var onSuccess = function(position) {
    var lat       = position.coords.latitude;
    var lng       = position.coords.longitude;

   alert(lat +"\n" + lng);
  // onError Callback receives a PositionError object
  function onError(error) {
      alert('code: '    + error.code    + '\n' +
            'message: ' + error.message + '\n');
  navigator.geolocation.getCurrentPosition(onSuccess, onError)


save it
ionic build ios
ionic emulate ios

First you will see the proper message saying that your app wants to use your location, then after that you will see this poping up:

Any idea how to fix this? I’ve tried ngcordova and doesn’t work too
The same happens on the emulator

Here’s the QR code if you want to use the ionic view

Or just download the project: here

What version of iOS is that, 6?
We don’t support iOS6 and apple won’t let the app be submitted unless its built for iOS7


This is very interesting…not sure what the issue could be.
I’m seeing this on iOS8 as well.
Hmm, alright I just opened an issue for this on cordova issue tracker.

1 Like

yes it is 6.1
I didn’t know about only ios 7+ support but that’s fine, except the fact this message shows up and it will make users to freak out. I hope it gets fixed :slight_smile: Thanks, have a good day!

1 Like

Any progress on this? Could you link the issue on github?

I’ve also tested this on IPhone 4S with iOS 8.1.3 and it has the same problem, so it’s not the iOS.

just found the “solution” ( more like a workaround )

the answer is from StackOverflow: [Location permission alert on iPhone with PhoneGap][1]

You need to do the geolocation after the device is ready. The following Jquery code, for example, will geolocate without that nasty alert:

  document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
  navigator.geolocation.getCurrentPosition(onSuccess, onError);     
function onSuccess(position) {
  // your callback here 
function onError(error) { 
  // your callback here

In ionic you would put it insdie $ionicPlatform.ready(function() {
[1]: cordova - Location permission alert on iPhone with PhoneGap - Stack Overflow

1 Like

Right, but in my case, I did wrap it in a .ready event.

Did that solution work for you?

It did!! lol sorry I totally missed your response :# Anyway, I’m loving ionic!

@betoharres @mhartington sorry if noise you,but im really trouble with this problem.My code like this:


function readyHandler() {
	if (navigator.geolocation) {
		navigator.geolocation.getCurrentPosition(successHandler, errorHandler, {
			enableHighAccuracy: true,
			maximumAge: 30000,
			timeout: 8000


Hi, Can you please post a solution here ?

Got same issue with my app
Somehow its works when im using 3G data transfering. Wifi connection throws PositionError