|
|
|
|
@ -245,8 +245,8 @@ export class HomePage implements OnInit {
|
|
|
|
|
this.permissions.requestLocationAutherization().then(granted => {
|
|
|
|
|
this.location = granted as boolean;
|
|
|
|
|
if (this.location) {
|
|
|
|
|
this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
|
|
|
|
|
if (this.platform.is('android')) {
|
|
|
|
|
if (this.platform.is('android')) {
|
|
|
|
|
this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
|
|
|
|
|
if (resp && (resp.latitude && resp.longitude)) {
|
|
|
|
|
if (resp.isFromMockProvider || resp.mockLocationsEnabled) {
|
|
|
|
|
this.isFakeLocationUsed = true;
|
|
|
|
|
@ -254,19 +254,25 @@ export class HomePage implements OnInit {
|
|
|
|
|
this.lat = resp.latitude;
|
|
|
|
|
this.longt = resp.longitude;
|
|
|
|
|
this.attendance();
|
|
|
|
|
} else {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (resp && (resp.latitude && resp.longitude)) {
|
|
|
|
|
this.lat = resp.latitude;
|
|
|
|
|
this.longt = resp.longitude;
|
|
|
|
|
}, (error) => {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.geolocation.getCurrentPosition({maximumAge: 3000, timeout: 10000, enableHighAccuracy: true}).then(resp => {
|
|
|
|
|
if(resp && resp.coords.latitude && resp.coords.longitude) {
|
|
|
|
|
this.lat = resp.coords.latitude;
|
|
|
|
|
this.longt = resp.coords.longitude;
|
|
|
|
|
this.attendance();
|
|
|
|
|
} else {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, (error) => {
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|