getCurrentPosition crash


Hi guys,
this is my snippet

navigator.geolocation.getCurrentPosition(function (position) {

          $scope.position = position;

        }); // getCurrentPosition()

When I start my android app, it’s asking for permission. I agree and the app is crashing. Same with the cordova plugin. Any suggestions?
By the way: The browser gives me the coordinates.


use code like this to see problem

if (window.Connection) {

            if (navigator.connection.type == Connection.NONE) {


                    title: "Internet is not working",

                    content: "Internet is not working on your device."




explore more this url , may be helpful.


I’m having the same issue, and is not because to a resource not yet loaded as suggest @virender.
Looks like the app asks for geolocation permission, and when i grant the permission, the app crashes.


Maybe it’s helping you. I wrote a factory for this problem and it worked!

My factory

var googleMapsService = function($q, $cordovaGeolocation) {

	// Variable, etc.
	var factory = {};
	var deferred = $q.defer();
	var position = {};
	var posOptions = {timeout: 10000, enableHighAccuracy: false};

  // Ermittlung der Smartphone Position
  factory.getCurrentPosition = function() {
      .then(function(position) {
      }, function(err) {
        // error
      return deferred.promise;

	return factory;

My controller

    .then(function(position) {
      $rootScope.position = position;