- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had a test app that used Cordova geolocation, but no longer works. From what I have read, Cordova has deprecated their geolocation plugin in favor of HTML 5 native geolocation. I've tried that with the code below and it works in the emulator and debug mode, but not in an Android XDK build. I've read previous posts that suggest using the Intel geolocation, but that plugin is still marked as deprecated. What is the correct way to do geolocation in the XDK for multiplatform development.
function getLocation() { if (navigator.geolocation) { navigator.geolocation.watchPosition(showPosition, showError); } else { alert("Geolocation is not supported by this browser."); } } function showPosition(position) { alert("location found"); } function showError(error) { alert("error"); }
- Tags:
- HTML5
- Intel® XDK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Android webviews are not very good about this. If you use the Cordova geo plugin it will defer to the builtin geo if it finds it there, otherwise it will use the plugin implementation. Don't use the Android webviews, that's the main source of your troubles. Use the Android-Crosswalk build instead. I recommend you set the Crosswalk build to 14.
Also, try the geo code in this example, it's more complete: https://github.com/xmnboy/hello-cordova
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the quick reply. That is the code I had and did not work when I used the XDK Android build process. I'll check it carefully and try it again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Android webviews are not very good about this. If you use the Cordova geo plugin it will defer to the builtin geo if it finds it there, otherwise it will use the plugin implementation. Don't use the Android webviews, that's the main source of your troubles. Use the Android-Crosswalk build instead. I recommend you set the Crosswalk build to 14.
Also, try the geo code in this example, it's more complete: https://github.com/xmnboy/hello-cordova

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page