- I am facing the following error while asking the user for location permission in my app.
- It asks for location permission twice when loading the page.
- Earlier in my previous uploaded version on the app store, it was working properly and to give new update, I am facing this issue
async getLocation() {
const _this = this;
return new Promise(function (resolve, reject) {
_this.geolocation.getCurrentPosition().then((resp) => {
resolve(CommonUtilService.truncateTo5(resp.coords.latitude) + ',' + CommonUtilService.truncateTo5(resp.coords.longitude));
}).catch((error) => {
console.log('Error getting location', error);
resolve('10.000000,11.000000');
});
});
}
- Please help me figure this out. I can provide additional info on my project configuration if needed; I am unsure where to look for this behaviour.
Sorry, my bad.
I am calling this function in ngOnInit(){}
async ngOnInit() {
this.orderId = this.activatedRoute.snapshot.paramMap.get('orderId');
this.mode = this.activatedRoute.snapshot.paramMap.get('mode');
console.log('this.assignedTo : ' + this.assignedTo);
//just for permission
await this.getLocation();
}