User Tools

Site Tools


intents:google_maps

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
intents:google_maps [2016/05/06 17:36]
administrator created
intents:google_maps [2018/12/30 13:30] (current)
Line 1: Line 1:
 ====== Google Maps ====== ====== Google Maps ======
-This is the base information on calling Google maps intents.+This is the base information on using intents to call the Google Maps app.
  
 [[https://developers.google.com/maps/documentation/android-api/intents]] [[https://developers.google.com/maps/documentation/android-api/intents]]
  
 ===== Basic Map ===== ===== Basic Map =====
-This is intent draws a map with the centre of the map at the location provided by latitude and longitude.+This intent call the Google Maps app to draw a map with its centre at the location provided by latitude and longitude.
  
 <code JavaScript simpleMap.js> <code JavaScript simpleMap.js>
  
 +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);
 +    }
 +}
 +</code>
 +===== Turn by Turn Navigation =====
 +This function could be used instead of simpleMap above to start navigating towards the destination.
 +<code JavaScript navigate.js>
 +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");
 +}
 </code> </code>
- 
intents/google_maps.1462556189.txt.gz ยท Last modified: 2016/05/07 01:36 (external edit)