i have implemented tracking functionality in ionic3 app its working perfectly in all android version below 9 but in some android 9 version devices its not working.
So lets start,after testing my App on four real devices, I distinguished three different behaviors:
Android 7.1.x (Redmi MI 4A) => working Correctly
Android 9 => i will check in 2 different devices both are android 9 version 1st “Nokia 6” in which watchPosition fire properly but in the another devices - Oppo F11 -pro watchPosition function not fire function.
/getLocationModeForIos for execute only for IOS
getLocationMode() {
var self = this;
//if map exist..
if(self.mapElement) {
self.platform.ready().then((readySource) => {
//
let mapOptions = {
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false,
streetViewControl: false,
fullscreenControl: false,
draggable : true
}
self.map = new google.maps.Map(self.mapElement.nativeElement, mapOptions);
//get user currentLocation and update user location after move move
self.watch = self.geolocation.watchPosition();
self.subscription = self.watch.subscribe((position) => {
var latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
console.log('lat fire1.....', +position.coords.latitude);
console.log('long fire.....', +position.coords.longitude);
//set center to map and set zoom....
self.map.setCenter(latLng);
self.map.setZoom(16);
}, (err) => {
console.log(err);
});
});
}
}