Intel XDK Geolocation Sample

The source code for this sample can be found here: https://github.com/gomobile/sample-geolocation or download the Intel(R) XDK to check out all the HTML5 Samples.

Purpose

The Geolocation application is meant to demonstrate how to create a hybrid mobile application that takes advantage of the geolocation services of the JavaScript bridge API as well as connect to mapping Web services that are available for free online.

The Geolocation sample application is meant to track the user’s progress as they travel by dropping a pin on the map every 10 seconds. That way, the user is able to record their progress and perhaps expand on this data to create an application of their own.

Source Code

There are two important components to this application. Both are found in the js/main.js file. First, the code that detects the device’s latitude and longitude from its geolocation services using the JavaScript API bridge (intelxdk.js) is shown below.

Secondly, the code that creates the map if there are no points to plot is here.

Limitations

This application is only meant for smart phone devices and not for tablets. It may not size appropriately depending on which device it runs on.

Testing

This sample application has been tested on a variety of iOS and Android smartphones.