rehman22 opened a new issue #220:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/220


   # Bug Report
   **on andrion 9 i am getting respone and value but on andriod 9  no responce**
    
    
   
   
   ###  Code
   import { Component, NgZone } from '@angular/core';
   import { Geolocation } from '@ionic-native/geolocation/ngx';
   import { NativeGeocoder, NativeGeocoderResult, NativeGeocoderOptions } from 
'@ionic-native/native-geocoder/ngx';
    
   @Component({
     selector: 'app-home',
     templateUrl: 'home.page.html',
     styleUrls: ['home.page.scss'],
   })
   
   export class HomePage {
     latitude: any = 0; //latitude
     longitude: any = 0; //longitude
     address: string;
   
     constructor(
       private geolocation: Geolocation,
       private nativeGeocoder: NativeGeocoder
     ) {}
   
     // geolocation options
     options = {
       timeout: 10000, 
        
       maximumAge: 3600
     };
   
     // use geolocation to get user's device coordinates
     getCurrentCoordinates() {
       this.geolocation.getCurrentPosition().then((resp) => {
         console.log(resp)
         this.latitude = resp.coords.latitude;
         this.longitude = resp.coords.longitude;
        // this.getAddress(this.latitude, this.longitude);
        }).catch((error) => {
          console.log(' getting location', error);
        });
     }
   
     // geocoder options
     nativeGeocoderOptions: NativeGeocoderOptions = {
       useLocale: true,
       maxResults: 5
     };
   
     // get address using coordinates
     getAddress(lat,long){
       this.nativeGeocoder.reverseGeocode(lat, long, this.nativeGeocoderOptions)
       .then((res: NativeGeocoderResult[]) => {
         this.address = this.pretifyAddress(res[0]);
       })
       .catch((error: any) => {
         alert('Error getting location'+ JSON.stringify(error));
       });
     }
   
     // address
     pretifyAddress(address){
       let obj = [];
       let data = "";
       for (let key in address) {
         obj.push(address[key]);
       }
       obj.reverse();
       for (let val in obj) {
         if(obj[val].length)
         data += obj[val]+', ';
       }
       return address.slice(0, -2);
     }
   }
   
    


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to