I have the following code using Ionic native geolocation :
import { Geolocation } from 'ionic-native'; this.platform.ready().then(() => { alert('loadMap about to getCurrentPosition'); Geolocation.getCurrentPosition(options).then((position) => { alert('loadMap getCurrentPosition'); let latLng: google.maps.LatLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); bound.extend(latLng); this.load(bound); }); });
When I run it as ionic serve in the browser, or I create it and run it on iOS Simulator ( Xcode ), it works. However, when I build it for Android and try to run it, the first warning will be triggered, but not the second.
This means only for Android , Geolocation.getCurrentPosition... does not work.
I have another page that can display a map through this.map = new google.maps.Map(htmlElement, mapOptions); , so it seems like the problem is getting the current position. When I install the application, I get this message:
Allow AppName to access the device location? DENY ALLOW
Which I click on Allow .
Does anyone know what I'm doing wrong, or if there are some missing steps during the installation and build of Android?
thanks
source share