DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


Sidebar

News

Version1.42 is out since December 2nd 2016


Frequently Asked Questions


Namespaces

Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax

intents:google_maps

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.

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);
    }
}

Turn by Turn Navigation

This function could be used instead of simpleMap above to start navigating towards the destination.

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");
}
intents/google_maps.txt · Last modified: 2017/03/12 08:44 by stevegarman