import {Geolocation} from 'ionic/ionic';
export class Locations {
constructor() {
console.log('entering constructor');
let options = {timeout: 10000, enableHighAccuracy: true};
Geolocation.getCurrentPosition(options).then((position) => {
let lat = position.coords.latitude
let long = position.coords.longitude
}, (err) => {
// error
});
//switching to Geolocation.getCurrentPosition to navigator.geolocation.getCurrentPosition
//causes an error saying the 1st argument is not a function
}
}
However, the code above results in an error that getCurrentPosition of undefined can’t be retrieved. Is the documentation for Geolocation out of date or am I doing something wrong?
It appears that is our only option at the moment. Hopefully one more bump to the front page will catch the attention of somebody on the dev team who can shed some light if this feature is going to be baked in as their other posts/documentation suggest.
@tim - Sorry Tim, you’re the only person I’ve ever got a response from on Ionic 2 so I’m going to try to pull you in to help us
Hey guys! So we pulled out the plugin classes since it didn’t make sense to update ionic when we just need to fix a plugin class.
We’re currently working on ionic-native, which will be installed when you create a new app. This will allow the plugin classes to get updated and released at a faster pace than the framework.
But if you need to use a plugin thats not in ionic-native, you can always just use the window.PLUGIN-NAME api that is in each cordova plugin doc.