0

i am trying to integrate [This]https://github.com/louisbl/cordova-plugin-locationservices plugin into my ionic 4 app.

since its a non ionic-native plugin, how do i go about calling its functions withing my typescript code?

i have tried using declare var locationservices: any; locationServices.geolocation.getCurrentPosition(geolocationSuccess,[geolocationError],geolocationOptions]);

but i get an error that locationservices is not defined

1 Answer 1

1

so instead of using declare var locationservices: any i used declare var cordova: any;

`declare var cordova: any;
cordova.plugins.locationServices.geolocation.getCurrentPosition(
      position => {
         console.log(position)
      }
    );`

NB:the code will always result to undefined when tested on a browser, it needs to be tested on a device

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.