@apars wrote:
I'm following the steps at http://ionicframework.com/docs/v2/platform/geolocation/ to call the geolocation plugin:
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?
Posts: 1
Participants: 1