Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- constructor(
- private geolocation: Geolocation,
- private nativegeocoder: NativeGeocoder
- ) {
- this.getGeoLocation();
- }
- getGeoLocation() {
- const options: NativeGeocoderOptions = {
- useLocale: true,
- maxResults: 5
- };
- this.geolocation.getCurrentPosition().then((resp) => {
- console.log(resp);
- this.nativegeocoder.reverseGeocode(resp.coords.latitude, resp.coords.longitude, options)
- .then((result: NativeGeocoderResult[]) => {
- console.log(JSON.stringify(result[0]));
- }).catch((error) => console.log(error));
- }).catch((error) => {
- console.log(error);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement