Hello everyone! that’s my question, how can i calibrate the device gps before location request?
I’m imagining something like on components.ts force a request at the beginning 
someone tryed before?
the plugin that im using is this cordova-plugin-gpslocation
any help very apreciated, greetings
global packages:
@ionic/cli-utils : 1.5.0
Cordova CLI : 8.1.2 (cordova-lib@8.1.1)
Ionic CLI : 3.5.0
local packages:
@ionic/app-scripts : 1.3.12
Cordova Platforms : android 7.1.4
Ionic Framework : ionic-angular 3.5.0
System:
Node : v6.9.0
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.8
Hello,
calibrate gps? Please apoligsie my question. Ca you explain what this is?
Best regards, anna-liebt
1 Like
when I retrieve the location on the first try no location data is retrieved, on a second try even. But after that “warm” the data is retrieved and more or less accurate, I dont know why…
At the begining the problem with no data was the android permissions (problem solved) but now i dont know whats happening
Hello,
maybe a timming problem in your code. Please show related code.
Best regards, anna-liebt
//somename.ts
cargarCoordsModal(bot_id){
let loader = this.loading.create({
content: 'Cargando...',
duration: 10000
});
loader.present().then(() => {
this.service.obtenerLocacion().then( obtenido => {
let lat = obtenido['coords']['latitude'];
let lng = obtenido['coords']['longitude'];
let tiempo_gps = obtenido['timestamp'];
loader.dismiss();
let mimodal = this.modalCtrl.create( 'ModalPage', {lat: lat, lng: lng, bot_id:bot_id, tiempo: tiempo_gps} );
mimodal.present();
}
).catch((err) => {
loader.dismiss();
//this.handleError(err);
});
});
}
//service.ts
obtenerLocacion():Promise<string>{
return new Promise(
function (resolve, reject) {
GPSLocation.getCurrentPosition(function (data) {
resolve(data);
},
function (error) {
alert(JSON.stringify(error)); //HERE! the message error throwed at first try
},
{
enableHighAccuracy: true,
timeout: 10000,
maximumAge: 3000
});
}
);
};
PD: the error message is throwed before the 10 seconds loader ends, so I think that the loader is not the problem, right?