Ionic2: geolocation in the browser is not with an error: EXCLUSION: Unprepared (in the promise): false

I am working with a geolocation plugin with ionic2. When the application loads in the browser, it asks for permission. But it does not get the position when calling getcurrentposition. I am using FireFox browser.

The console log shows an error:

EXCEPTION: Not available (in promise): false

I need to pass the location, if available, or null for another function based on the success or failure of the getcurrentlocation call.

Here is the code snippet:

 public test(){
 Geolocation.getCurrentPosition().then((resp) => {

 console.log (resp.coords.latitude);
 console.log (resp.coords.longitude);

  this.callclockin(resp.coords.latitude, resp.coords.longitude);    
 }).catch((error) => {
  this.callclockin("", "");   
 });
 }
+2
source share
1 answer

The plugin is Geolocationdesigned for mobile devices.

, catch ,

+2

Source: https://habr.com/ru/post/1677165/


All Articles