====== Google Maps ======
This is the base information on using intents to call the Google Maps app.
[[https://developers.google.com/maps/documentation/android-api/intents]]
===== Basic Map =====
This intent call the Google Maps app to draw a map with its centre at the location provided by latitude and longitude.
function OnStart()
{
var lat="51.5117";
var lng="-0.1275";
simpleMap(lat,lng);
}
function simpleMap(latitude,longitude)
{
var packageName = "com.google.android.apps.maps";
var className = null;
var action = "android.intent.action.VIEW";
var uri = "geo:"+latitude+","+longitude;
if(app.IsAppInstalled( packageName ))
app.SendIntent( packageName, className, action,null,uri );
else
{
app.Alert("maps app not installed");
app.OpenUrl("market://details?id="+packageName);
}
}
===== Turn by Turn Navigation =====
This function could be used instead of simpleMap above to start navigating towards the destination.
function navigateTo(latitude,longitude)
{
var packageName = "com.google.android.apps.maps";
var className = null;
var action = "android.intent.action.VIEW";
var uri = "google.navigation:q="+latitude+","+longitude;
if(app.IsAppInstalled( packageName ))
app.SendIntent( packageName, className, action,null,uri );
else
app.Alert("maps app not installed");
}