I am developing an IONIC v4 app with a map tab that does geolocation and Google Maps API NearbySearch()
the app compiles and the map functions properly on:
$ ionic s
but when i run:
$ ionic s --lab
the app compiles fine but on the map tab, i log an error:
Geolocation access has been blocked because of a Feature Policy applied to the current document. See for more details.
or
navigator error PositionError {code: 1, message: “Geolocation has been disabled in this document by Feature Policy.”}
this looks like it is part of some sort of update to the Google APIs for security/privacy, just wondering if anyone else has encounter or solved this problem yet: Chromium project link
CODE IN QUESTION:
center: any;
options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
initialize(mapRef: ElementRef, searchInput: HTMLInputElement) {
this.mapsApiLoader.load().then(async () => {
if (this.platform.is('cordova')) {
//native geolocator
}
else {
navigator.geolocation.getCurrentPosition((position) => {
this.center = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
//initialize map
//initialize other map apis
}, (error) => {
console.log('navigator error', error); /* THIS ERROR IS LOGGED in '--lab' */
}, this.options);
}