You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/01/05 19:24:28 UTC

[GitHub] [cordova-plugin-geolocation] rehman22 opened a new issue #220: Andriod 9 and below not working

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-geolocation] timbru31 commented on issue #220: Andriod 9 and below not working

Posted by GitBox <gi...@apache.org>.
timbru31 commented on issue #220:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/220#issuecomment-754962636


   Thanks a lot for your issue, however the issue template exists for a reason. 😊   
   It helps us to debug the issue further and to provide a solution much faster. With important information missing, we unfortunately can't help you.
   
   Therefore, please edit this issue accordingly or close and create a new one and make sure to provide all the required information.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-geolocation] timbru31 closed issue #220: Andriod 9 and below not working

Posted by GitBox <gi...@apache.org>.
timbru31 closed issue #220:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/220


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org