Settings Class Reference

Settings.isTablet() Settings.getFileUrl(fileid) Settings.getPlatform() Settings.getLocation() Settings.getLanguage()

Settings.isTablet()

Returns true if the device is a tablet (iPad or Android tablet). Web browser return also true.

if (Settings.isTablet())  {
    // do someting specific to tablet/ web
    Toolbar.addButon("Export Excel", "exportExcel()");
} else {
    // phone
}

Settings.getPlatform()

Returns "android", "iphone", "blackberry", "windowsphone" or "web"

It enables for example to execute custom code or have some custom UI elements for a given platform, for example on web interface only

if (Settings.getPlatform() == "web") Toolbar.addButton("Import CSV", "importData()");

Settings.getLocation()

Returns the geo coordinates as string lat,lng of the current device location

On Web, it returns an empty string ""

Settings.getFileUrl(fileid)

Returns the absolute URL of the file stored in UpviseJS Cloud identified by its file primary key fileid from the system.files table

var contactid="somecontactid";
var files = Query.select("system.files", "id;name;date", "linkedtable='contacts.contacts' AND linkedrecid={contactid}");
for (var i = 0; i < files.length; i++) {
    var file = files[i];
    var url = Settings.getFileUrl(file.id);
    .....
}

Settings.getLanguage()

Returns the phone language as a 2 letter string, for example "en", "fr", "de", ...

var lang = Settings.getLanguage();