@HeyItsMatty wrote:
Hi there, i am trying to use the Geolocation native plugin to grab the users location for use in our app. WHen running the code in the browser through ionic lab (see code below) the code works fine, however when running it on my iOS device it leads to the timeout being triggered instead of the actual code. No errors are flagging up when running the sudo ionic cordova prepare command which makes it difficult to debug. The code:
app.component.ts
import { Geolocation } from '@ionic-native/geolocation'; // code up until the constructor constructor (public location: Geolocation; //and other vars) { } initializeApp() { this,platform.ready().then(() => { //other native code this.location.getCurrentPosition({ enableHighAccuracy: true, timeout: 30000, maximumAge: 0 }).then((position) => { alert(position.coords.longitude); alert(position.coords.latitude); }).catch((error) => { alert(JSON.stringify(error)); }); }); }
I can’t work out why it isn’t working on the device. For some reason when i head into my device settings > APPNAME > there is no toggle switch for accessing location. I have checked my config.xml and have the valid iOS11 variable to request the permission to use the location of the device. However the device never asks for my position which may possibly be the problem?
Any help will be much appreciated.
Posts: 1
Participants: 1