Problen with diagnostic and geolocation on Android +6

#1

hello guys.

I am trying to getcurrent position using geolocation and diagnostic , but it doesnt function well on android device +6 .

I’ve used observables to achieve that :
>

this._gps.diagnosticGPSFlatMap()
.flatMap(res => {
if (res)
{
let options={ maximumAge: 3000, timeout: 5000, enableHighAccuracy: true };
return Observable.fromPromise(this.geolocation.getCurrentPosition(options));
}
else
return Observable.throw(“errorGPSEnabled”);
})
.flatMap(res => {
this.lat = res.coords.latitude;
this.lng = res.coords.longitude;
return this.callObservablesToPrintMap();
})
.subscribe(results => {
alert(“PRINT MAP WITH MY POSITION”)
}, error => {
alert(“ERROR”+JSON.stringify(error));
this.showMap = false;
console.log(“ERROR” + JSON.stringify(error))
if (error === “errorGPSEnabled”) {
this.activateGPS()
} else if (error === “appLocationDenied”) {
this.navCtrl.pop().then(() => this.diagnostic.requestRuntimePermission(this.diagnostic.permission.ACCESS_FINE_LOCATION))
.then(()=>console.log(“OK”))
.catch(error=>console.log(error));
}
})

My service is :
diagnosticGPSFlatMap(): Observable {
let locationAuthObs = Observable.fromPromise(this.diagnostic.isLocationAuthorized());
let locationEnabledObs = Observable.fromPromise(this.diagnostic.isLocationEnabled());

return locationAuthObs
  .flatMap(res => {
    if (res)
      return locationEnabledObs;
    else
      return Observable.throw("appLocationDenied")
  })
  .catch(error => {
    return Observable.throw(error)
  });

}
I’ve control if app location authorized is ok and if Gps is enable.

And I’ve catched errors to user turn on GPS or the app show alert to authorize app gps.

On android +6 I am getting error : {}

On android -6 , it function well

Could someone help me ?