Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Last active June 23, 2017 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieu-D/fc22a9ffd697488e3f78bc3325c362f4 to your computer and use it in GitHub Desktop.
Save matthieu-D/fc22a9ffd697488e3f78bc3325c362f4 to your computer and use it in GitHub Desktop.
use geoloc
import { Platform } from 'ionic-angular';
import { Geolocation } from '@ionic-native/geolocation';
.
.
.
export class MyApp {
rootPage:any = HomePage;
constructor(platform: Platform, geolocation: Geolocation) {
platform.ready().then(() => {
geolocation.getCurrentPosition().then((location) => {
console.log(location);
}).catch((error) => {
console.log('Error getting location', error);
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment