Geolocation plugin from ionic is not working in windows phone 10 device


#1

Hi Team,

I am using below code for Geolocation plugin.

Help me to fix this issue.

this.ionAlert.showBasic("Failed","1entered");
  Geolocation.getCurrentPosition().then((resp) => {
    this.ionAlert.showBasic("SUCCESS",resp.coords.latitude);
    this.ionAlert.showBasic("SUCCESS",resp.coords.longitude);
}).catch((error) => {
  console.log('Error getting location', error);
  this.ionAlert.showBasic("FAILED",error);
});

catch block is executing.

Regards,
K Mohammad Mujahid


#2

(I changed your post to format your code or error message correctly. Please use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.)

What is error saying?
Are you using the plugin via Ionic Native?


#3

Yes I am using ionic native plugin. I have created the new project. But in new project it’s working as expected. I am not getting what was the issue with this project.


#4

The issue is likely that you were trying to use v2 static class method syntax with ionic-native v3, which wants you to inject plugin shim objects and call object methods on them instead.