Example - GetDeviceSpecs
var allBuilds = JSON.parse('{' +
'"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"}, ' +
' "23":{"level":23,"codename":"MarshMallow","version":"6.0"}, ' +
' "24":{"level":24,"codename":"Nougat","version":"7.0"}, ' +
' "25":{"level":25,"codename":"Nougat","version":"7.1"}, ' +
' "26":{"level":26,"codename":"Oreo","version":"8.0"}, ' +
' "27":{"level":27,"codename":"Oreo","version":"8.1"}, ' +
' "28":{"level":28,"codename":"Pie","version":"9"}, ' +
' "29":{"level":29,"codename":"Q","version":"10"}, ' +
' "30":{"level":30,"codename":"R","version":"11"}, ' +
' "31":{"level":31,"codename":"S","version":"12"}, ' +
' "32":{"level":32,"codename":"S_V2","version":"12"} ' +
' }');
var osObj = allBuilds[app.GetOSVersion()]
try
{
var osInfo = "Android " + osObj.version + " (" +
osObj.codename + ") API level " +
osObj.level
}
catch(err){var osInfo = app.GetOSVersion();}
var lay, txt, scroller
function OnStart()
{
lay = app.CreateLayout("linear", "VCenter,FillXY");
scroller = app.CreateScroller(1, 0.8);
var specs = getDeviceSpecs();
txt = app.CreateText(specs, 1, 0.8, "left,multiLine");
txt.SetPadding(0.02, 0.01, 0.02, 0.01);
scroller.AddChild(txt);
lay.AddChild(scroller);
var btn = app.CreateButton("[fa-copy]", -1, -1, "fontAwesome");
btn.SetTextSize( 32 )
btn.SetOnTouch(btn_OnTouch);
lay.AddChild(btn);
app.AddLayout(lay);
OnConfig()
}
function btn_OnTouch()
{
app.SetClipboardText(txt.GetText( ) );
app.ShowPopup("Copied to clipboard")
}
function getBuilderVersion()
{
var msg = "Apk Builder plugin not installed";
var path = app.GetPrivateFolder("Plugins") +
"/apkbuilder/Version.txt"
if(app.FileExists(path))
{
msg = "Apk Builder version " + app.ReadFile( path )
}
else if(app.IsAPK())
{
msg = "APK built with " + app.GetDSVersion().toFixed(2);
}
return msg
}
function getDeviceSpecs()
{
var os = app.GetOSVersion();
var model = app.GetModel();
var tablet = app.IsTablet();
var fromapk = app.IsAPK();
var isChrome = app.IsChrome();
var isPrem = app.IsPremium();
var isTV = app.IsTV();
var dsversion = app.GetDSVersion().toFixed(2);
var sw = app.GetScreenWidth();
var sh = app.GetScreenHeight();
var dens = app.GetScreenDensity();
var dw = app.GetDisplayWidth();
var dh = app.GetDisplayHeight();
var intfld = app.GetInternalFolder();
var extfld = app.GetExternalFolder();
var intspace = app.GetFreeSpace("internal");
var extspace = app.GetFreeSpace("external");
var mem = app.GetMemoryInfo().total.toLocaleString("en-US");
try { os = osInfo; }
catch(err) {}
var s = "/*\n" +
"os=" + os + "\n" +
getBuilderVersion() + "\n" +
"tablet=" + tablet + "\n" +
"model=" + model + "\n" +
"isChrome=" + isChrome + "\n" +
"isTV=" + isTV +"\n" +
"DroidScript=" + dsversion + "\n" +
"Storage access=" + storageScoped() + "\n" +
"screen width=" + sw + "\n" +
"screen height=" + sh + "\n" +
"screen density=" + dens + "\n" +
"display width=" + dw + "\n" +
"display height=" + dh + "\n" +
"internal folder=" + intfld + "\n" +
"external folder=" + extfld + "\n" +
"int free space=" + intspace + "\n" +
"ext free space=" + extspace + "\n" +
"memory=" + mem +"\n" +
"premium=" + isPrem +"\n" +
"country code=" + app.GetCountryCode() + "\n" +
"country=" + app.GetCountry() + "\n" +
"language code=" + app.GetLanguageCode() + "\n" +
"language=" + app.GetLanguage() + "\n" +
"wifi=" + app.GetIPAddress() + "\n" +
"userAgent='" + navigator.userAgent + "'\n" +
"*/";
return(s);
}
function storageScoped() {
return app.IsScoped()?"Scoped":"Traditional";
}
function OnConfig()
{
var fixwid = lay.GetAbsWidth()/app.GetDisplayWidth();
var fixhigh = lay.GetAbsHeight()/app.GetDisplayHeight();
var wid = 1, high = 0.8;
if (fixwid<1) wid *= fixwid;
if (fixhigh<1) high *= fixhigh;
scroller.SetSize( wid,high );
txt.SetSize( wid, high );
}
allBuilds = JSON.parse('' +
'"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", ' +
' "23":"level":23,"codename":"MarshMallow","version":"6.0", ' +
' "24":"level":24,"codename":"Nougat","version":"7.0", ' +
' "25":"level":25,"codename":"Nougat","version":"7.1", ' +
' "26":"level":26,"codename":"Oreo","version":"8.0", ' +
' "27":"level":27,"codename":"Oreo","version":"8.1", ' +
' "28":"level":28,"codename":"Pie","version":"9", ' +
' "29":"level":29,"codename":"Q","version":"10", ' +
' "30":"level":30,"codename":"R","version":"11", ' +
' "31":"level":31,"codename":"S","version":"12", ' +
' "32":"level":32,"codename":"S_V2","version":"12"' +
'')
osObj = allBuilds[app.GetOSVersion()]
try:
osInfo = "Android " + osObj.version + " (" +
osObj.codename + ") API level " +
osObj.level
except err)osInfo = app.GetOSVersion(: pass
lay, txt, scroller
def OnStart():
lay = app.CreateLayout("linear", "VCenter,FillXY")
scroller = app.CreateScroller(1, 0.8)
specs = getDeviceSpecs()
txt = app.CreateText(specs, 1, 0.8, "left,multiLine")
txt.SetPadding(0.02, 0.01, 0.02, 0.01)
scroller.AddChild(txt)
lay.AddChild(scroller)
btn = app.CreateButton("[fa-copy]", -1, -1, "fontAwesome")
btn.SetTextSize( 32 )
btn.SetOnTouch(btn_OnTouch)
lay.AddChild(btn)
app.AddLayout(lay)
OnConfig()
def btn_OnTouch():
app.SetClipboardText(txt.GetText( ) )
app.ShowPopup("Copied to clipboard")
def getBuilderVersion():
msg = "Apk Builder plugin not installed"
path = app.GetPrivateFolder("Plugins") +
"/apkbuilder/Version.txt"
if app.FileExists(path):
msg = "Apk Builder version " + app.ReadFile( path )
elif app.IsAPK():
msg = "APK built with " + app.GetDSVersion().toFixed(2)
return msg
def getDeviceSpecs():
os = app.GetOSVersion()
model = app.GetModel()
tablet = app.IsTablet()
fromapk = app.IsAPK()
isChrome = app.IsChrome()
isPrem = app.IsPremium()
isTV = app.IsTV()
dsversion = app.GetDSVersion().toFixed(2)
sw = app.GetScreenWidth()
sh = app.GetScreenHeight()
dens = app.GetScreenDensity()
dw = app.GetDisplayWidth()
dh = app.GetDisplayHeight()
intfld = app.GetInternalFolder()
extfld = app.GetExternalFolder()
intspace = app.GetFreeSpace("internal")
extspace = app.GetFreeSpace("external")
mem = app.GetMemoryInfo().total.toLocaleString("en-US")
tryos = osInfo
except err:
s = "/*\n" +
"os=" + os + "\n" +
getBuilderVersion() + "\n" +
"tablet=" + tablet + "\n" +
"model=" + model + "\n" +
"isChrome=" + isChrome + "\n" +
"isTV=" + isTV +"\n" +
"DroidScript=" + dsversion + "\n" +
"Storage access=" + storageScoped() + "\n" +
"screen width=" + sw + "\n" +
"screen height=" + sh + "\n" +
"screen density=" + dens + "\n" +
"display width=" + dw + "\n" +
"display height=" + dh + "\n" +
"internal folder=" + intfld + "\n" +
"external folder=" + extfld + "\n" +
"int free space=" + intspace + "\n" +
"ext free space=" + extspace + "\n" +
"memory=" + mem +"\n" +
"premium=" + isPrem +"\n" +
"country code=" + app.GetCountryCode() + "\n" +
"country=" + app.GetCountry() + "\n" +
"language code=" + app.GetLanguageCode() + "\n" +
"language=" + app.GetLanguage() + "\n" +
"wifi=" + app.GetIPAddress() + "\n" +
"userAgent='" + navigator.userAgent + "'\n" +
"*/"
return(s)
def storageScoped():
return app.IsScoped()?"Scoped":"Traditional"
def OnConfig():
fixwid = lay.GetAbsWidth()/app.GetDisplayWidth()
fixhigh = lay.GetAbsHeight()/app.GetDisplayHeight()
wid = 1, high = 0.8
if fixwid<1: wid *= fixwid;
if fixhigh<1: high *= fixhigh;
scroller.SetSize( wid,high )
txt.SetSize( wid, high )