Closed jhonarodriguez closed 6 years ago
On the Android platform, this plugin provides a wrapper to call the native Google Play Services Location API which is what actually displays the native dialog and changes the location mode if the user agrees. Therefore any issue you're having with another plugin after changing location mode is caused by the native Play Services Location API, not this plugin directly which only invokes the native API.
Regardless of this, I understand from your description that this plugin works find with cordova-plugin-geolocation
but not the Google Maps plugin. Therefore I suggest you open the issue against the Google Maps plugin, not this one.
I'm submitting a ... (check one with "x"):
Bug report
Current behavior:
Expected behavior:
Steps to reproduce:
Environment information
cordova -v
cordova platform ls
cordova plugin ls
sw_vers
winver
Runtime issue
Android build issue:
node -v
ls platforms/android/.gradle
android:targetSdkVersion
inAndroidManifest.xml
sdkmanager --list | sed -e '/Available Packages/q'
iOS build issue:
node -v
If using an [Ionic Native Typescript wrapper]() for this plugin:
ionic info
npm list | grep "@ionic-native"
Related code:
Console output
console output
``` // Paste any relevant JS/native console output here ```**Other information:** # Feature request # Documentation issue Some time ago I was using this add-on, but after doing a test with the Google Maps Plugin, it turns out that it makes the request that it is necessary to turn on the GPS, and everything works well until there, the problem is that when I turn it on and go to use the google maps plugin function `map.getMyLocation().then().cath();` It does not execute anything, it does not enter either the .then () nor the .catch () function, but, after it is activated, if I deactivate the gps and turn it on MANUALLY !! there if you enter the google maps function. Perform another test with an application that I had a while ago, and the same problem occurs, or there are times when it takes the last position of the GPS where I was. I already asked the same question in the google maps plugin, I thought that they had something wrong there, but according to the creator, everything is working well, and he told me to communicate in the forum of this add-on. I hope someone can help me with this. I leave an example code. ``` import { LocationAccuracy } from '@ionic-native/location-accuracy'; import { GoogleMaps, GoogleMap, GoogleMapsEvent, GoogleMapOptions, Marker, MarkerLabel, MarkerClusterIcon, MarkerClusterOptions, MarkerCluster, CircleOptions, Circle } from '@ionic-native/google-maps'; @IonicPage() @Component({ selector: 'page-map', templateUrl: 'map.html', }) export class MapPage { map: GoogleMap; constructor( private navCtrl: NavController, public events: Events, private locationAccuracy: LocationAccuracy, public alertCtrl: AlertController, public plt: Platform ) { this.plt.ready().then(() => { this.readyPlatform(); }); } readyPlatform(){ this.locationAccuracy.canRequest().then((canRequest: boolean) => { // alert(canRequest); if(canRequest) { // the accuracy option will be ignored by iOS this.locationAccuracy.request(this.locationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then( () => { this.loadMap(); }, error => { let alert = this.alertCtrl.create({ title: 'Ups!', subTitle: 'Necesitamos que actives el gps para que funcione correctamente la aplicacion!', buttons: ['Aceptar'] }); alert.present(); } ); }else{ this.loadMap(); } }).catch((error) => { // alert('Error: ' + error); }); } loadMap(){ let mapOptions: GoogleMapOptions = { controls: { compass: false, myLocation: false, myLocationButton: false, mapToolbar: false }, preferences: { padding: { top: 70, left: 30, right: 30, bottom: 40 }, building: true } }; this.map = GoogleMaps.create('map_canvas', mapOptions); // Wait the MAP_READY before using any methods. this.map.one(GoogleMapsEvent.MAP_READY) .then(() => { this.getPosition(); }) .catch(error =>{ console.log(error); }); } getPosition(): void{ let optionsLocation = { enableHighAccuracy: true} this.map.getMyLocation(optionsLocation).then((resp) => { console.log(resp); }).catch((error) => { console.log('Error getting location', error); }); } } ``` The question is that when it reaches the function getPosition () does not work, it does not send error or anything. I am currently using the https://github.com/apache/cordova-plugin-geolocation plug-in but it takes a long time to get the location, so I would prefer to use the Google Maps plug-in.