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
Next revision Both sides next revision
intents:google_maps [2016/05/06 17:55]
stevegarman [Google Maps]
intents:google_maps [2017/03/12 08:44]
stevegarman Add navigation
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.txt · Last modified: 2018/12/30 13:30 (external edit)