- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
https://forums.html5dev-software.intel.com/viewtopic.php?f=34&t=11033&p=36038#p36038
BASED ON THIS^
ANY HINT why the code (also posted below) fails in Device although work in browser or ripple?
with XDK INTEL can use any editor? eg can edit in NetBeans run Cordova: android emulator in Netbeans,.. and still have the project in XDK IDE...Is this OK?
function onDeviceReady() { checkConnection(); } function checkConnection() { var networkState = navigator.connection.type; if (networkState == Connection.NONE || networkState == Connection.CELL_2G) alert("This App requires Internet Connection!\nPlease shut down App, connect and reopen App!"); if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(successFunction, errorFunction); } } function successFunction(position) { var lat = position.coords.latitude; var lng = position.coords.longitude; //alert(lat +" , "+lng); localStorage.setItem("lat", lat); localStorage.setItem("lng", lng); codeLatLng(lat, lng) } function errorFunction(){ alert("Geocoder failed"); } function codeLatLng(lat, lng) { var geocoder; geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(lat, lng); geocoder.geocode({'latLng': latlng}, function(results, status) { var address_line; if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { address_line = results[0].formatted_address; //console.log(address_line); $('#user-location').html(address_line); $('input[name="latlng"]').val(lat+','+lng); } else { $('#user-location').html("No results found - but you can search."); } } else { $('#user-location').html("Geocoder failed due to: " + status); } }); }
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Absolutely, just open your files and edit them in your favorite editor. However, note that you must use Brackets to use the "Live Layout Editing" feature.
Some popular editors among our users include:
Notepadd++ for a lighweight editor
Jetbrains editors (Webstorm)
Vim the editor
CodeLobster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When in Netbeans run cordova (Android native emulator) I have to have a config.xml file other than XDK Config file?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regarding your geo code, on a real device there is more complexity required of your code to insure you get a reading. See the file named cordova-geo.js in this sample app: https://github.com/xmnboy/hello-cordova. The app can be built and run on a real device, there are many comments and console.log messages to help you understand how it works. See this short tutorial for more help: https://github.com/xmnboy/hello-cordova/blob/master/docs/an-intel-xdk-debugging-tutorial.md
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
geocoder = new google.maps.Geocoder(); |
navigator.geolocation.getCurrentPosition(successFunction, errorFunction); |
// Basically my code runs when i implement code with using one of these lines... If use both code not work.
// you know how and in what order combine these two reverse geocode and detect current possition???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not familiar with the internal workings of the Google Maps library. It sounds like they are using the geolocation functions, which makes sense, so you're going to have to peer into their library to see how it uses that feature and if it's possible for you to work with the geo subsystem in a way that is compatible with their library. I'm guessing that one of you is overwriting the others success fail event handlers.
Sorry, this is not an XDK issue but a library conflict issue. Might be best to post on Stack Overflow and be sure to mention that you are trying to use Google Maps in a Cordova application.

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