Closed philipthomasme closed 3 years ago
I was running into the same issue as you. Currently I am using Meteor 1.3 Beta 3. Try to install https://github.com/apache/cordova-plugin-geolocation. Run: meteor add cordova:cordova-plugin-geolocation@2.1.0
This fixed the issue for me.
@matthewyt thank you, I'm giving it a try right now. Is there any additional configuration needed to change that prompt message?
This will not change the prompt message, but will limit it to the one popup which you get with any IOS app. I think the reason that two messages are showing up is because it uses the native one provided by Cordova and the browser based one which says "meteor.local" creating two prompts. Using this plugin should now only use the native call on IOS.
Copy that, thank you.
@matthewyt @derekclair Just to be clear: do you replace the mdg:geolocation package with the cordova plugin or do you simply add the cordova plugin on top of mdg's package?
I think you leave it so you have both installed. I have both angular geolocation and cordova plugin installed in my angular-meteor project. I think what the cordova plugin allows you to do is use the native navigation in a cordova build instead triggering the browser HTML5 location (since you are actually running your in a browser).
With my setup I get the HTML5 in a browser and the prompt to allow the app to use your location on first app install only.
@matthewyt Thanks for the answer. Why do you think this would change anything though? The mdg:geolocation package is nothing but a wrapper around the native cordova plugin and it has a dependency on that native plugin.
@skylerapp Yes it is just a wrapper but you need to install the cordova plugin to expose the native features otherwise it falls back to HTML5 on a cordova build like it would in a browser.
@matthewyt Makes sense of course. But doesn't the dependency in here[1] take care of that? [1] https://github.com/meteor/mobile-packages/blob/master/packages/mdg:geolocation/package.js
@skylerapp I am not sure how the dependencies work, like you, I would assume it downlods that version at build time if it doesnt exist in the project. I just remember fixing the issue by manually adding the cordova plugin. This could have been due to the dependency being an older version at the time of the creation of this issue. If your running into the double prompt just try to add the plugin manually and see if that fixes it.
@matthewyt Ok, will try. In any case, thank you for your answers!
@skylerapp
@matthewyt is correct it's just a wrapper. I did not add the Cordova Plugin separately, I have mdg:geolocation
exclusively.
As for the "http://meteor.local" prompt; it's been a little while, but I believe the resolution came with the $ meteor build --mobile-settings settings.json --server=https://server.com ../output/directory
script, which compiled everything so that the prompt would, as desired; prompt as configured in your App.info({ name })
.
RE: the multiple prompts, I determined it was an issue of the iOS app launching locally and requesting geolocation on startup via Meteor.startup();
. Then the "hot-reload" was received from the server, and the request was re-executed.
What I ended up doing was the following:
Template._page.onCreated(function () {
Tracker.autorun(function () {
var geolocation = Geolocation.latLng();
if (geolocation) { Session.set('userGeolocation', [ geolocation.lat, geolocation.lng ]); }
});
});
In those instances when the feature required the users geolocation. There are a few places in the app that use the same/similar code. This implementation pushes the iOS location request out of the Meteor.startup();
method and into what I think to be, a more accurate context of the App's user location request.
I haven't yet evaluated how the 'hot-code-reload' changes in 1.3 impact the issue, so I can't comment on that. But those changes might also have implications.
Hope that helps.
I'm closing this issue due to its age.
Unfortunately when I deploy an iOS App, the app asks for general permission (as it should) but also afterwards for "http://meteor.local" as it is a webview. Is there any way to bypass this second prompt or is this a "problem" you always have to deal with?
Thanks in advance.