DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


Sidebar

Privacy Policy

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

built_in:get_os_version

GetOSVersion

Sample code

AndroidVersion.js
var json = '{'+
'"1":{"level":1,"codename":"(no code name)","version":"1.0"}, ' +
'"2":{"level":2,"codename":"(no code name)","version":"1.1"} , ' +
'"3":{"level":3,"codename":"Cupcake","version":"1.5"}, ' +
'"4":{"level":4,"codename":"Donut","version":"1.6"}, ' +
'"5":{"level":5,"codename":"Eclair","version":"2.0"},  ' +
'"6":{"level":6,"codename":"Eclair","version":"2.0.1"}, ' + 
'"7":{"level":7,"codename":"Eclair","version":"2.1"}, ' + 
' "8":{"level":8,"codename":"Froyo","version":"2.2.x"}, ' + 
' "9":{"level":9,"codename":"Gingerbread","version":"2.3 - 2.3.2"}, ' + 
' "10":{"level":10,"codename":"Gingerbread","version":"2.3.3 - 2.3.7"}, ' + 
' "11":{"level":11,"codename":"Honeycomb","version":"3.0"}, ' + 
' "12":{"level":12,"codename":"Honeycomb","version":"3.1"}, ' + 
' "13":{"level":13,"codename":"Honeycomb","version":"3.2.x"}, ' + 
' "14":{"level":14,"codename":"Ice Cream Sandwich","version":"4.0.1 - 4.0.2"}, ' + 
' "15":{"level":15,"codename":"Ice Cream Sandwich","version":"4.0.3 - 4.0.4"}, ' + 
' "16":{"level":16,"codename":"Jelly Bean","version":"4.1.x"}, ' + 
' "17":{"level":17,"codename":"Jelly Bean","version":"4.2.x"}, ' + 
' "18":{"level":18,"codename":"Jelly Bean","version":"4.3.x"}, ' + 
' "19":{"level":19,"codename":"KitKat","version":"4.4 - 4.4.4"}, ' + 
' "20":{"level":20,"codename":"K or L","version":"4 or 5"}, ' + 
' "21":{"level":21,"codename":"Lollipop","version":"5.0"}, ' + 
' "22":{"level":22,"codename":"Lollipop","version":"5.1"} ' + 
' }'
 
var allBuilds = JSON.parse(json);
//Called when application is started.
function OnStart()
{
    var osObj = allBuilds[app.GetOSVersion()]
    var osInfo = osObj.level +"\n" + osObj.codename + "\n"+ osObj.version
    
    //Create a layout with objects vertically centered.
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );    
 
    //Create a text label and add it to layout.
    txt = app.CreateText( osInfo,-1,-1,"MultiLine" );
    lay.AddChild( txt );
    
    //Add layout to app.    
    app.AddLayout( lay );
}
built_in/get_os_version.txt · Last modified: 2015/03/30 21:40 by stevegarman