Ionic 2 current location doesn't return any thing and it times out when GPS is turned on after the app starts


#1

ionic 2 current location doesn’t return any positions when i fire up the app and then aks the user switch on the location. Once the user swtiches the GPS on and clicks the retry button to get the position of the user the getcurrent user location doent return any positions. However when the gps is on and i fire up the app every thing works.

I also check to see if the location is enabled first and then try to get the current location. any idea why would this happen ?

    Diagnostic.isLocationEnabled().then( bool =>{
        if( bool == false ){
          console.log("location is disbaled")
        }
        else{

            Geolocation.getCurrentPosition(options).then((position) => {

              this.usersLocation = {
                        lat: position.coords.latitude, 
                        lng: position.coords.longitude
                    };

              console.log('user location', this.usersLocation);                                                

            }).catch((error) => {

                console.log('falling back to deafult user location', 
                this.usersLocation);                                                

            });                                       
        }
    });