User Tools

Site Tools


intents:google_maps

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
intents:google_maps [2016/05/06 17:54]
stevegarman [Basic Map]
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]]
Line 8: Line 8:
  
 <code JavaScript simpleMap.js> <code JavaScript simpleMap.js>
 +
 function OnStart() function OnStart()
 { {
Line 20: Line 21:
     var action = "android.intent.action.VIEW";     var action = "android.intent.action.VIEW";
     var uri =  "geo:"+latitude+","+longitude;     var uri =  "geo:"+latitude+","+longitude;
-    app.SendIntent( packageName, className, action,null,uri );+    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.1462557242.txt.gz · Last modified: 2016/05/07 01:54 (external edit)