Reputation: 405
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
Upvotes: 0
Views: 245
Reputation: 405
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
Upvotes: 1