App Class Reference
This class contains methods to start eternal programs. All methods in this class are static.
Camera / Web / Video App.takePicture(linkedtable, linkedid) App.web(url) App.video(youtubeid) | Communication App.call(number) App.sms(number, message) App.mailto(email, subject) App.skype(skypeid) | User Interface App.alert(message) App.confirm(message) App.prompt(label, value, type) App.log(message) App.flashlight() |
QR Code & NFC App.scanCode(callback) App.writeNfc(function) | Maps App.map(address, geo) | Text to Speech App.tts(text) |
Files App.downloadFile(url, postData, useCache) App.downloadFiles(fileids) App.openFile(filepath) |
App.alert(message)
Displays a non blocking message (string). On Android, the message disapears after few seconds. On web, the message is display in yellow on the top of the screen and is removed the next time you navigate to a new page.
App.alert("Task Created");
App.call(number)
Call the number (string) by starting the default dialer application on mobile. On web, calls the number with Skype if it is locally installed.
App.call("9586 9485");
App.confirm(message)
Displays a blocking Yes / No dialog box with the message string. Returns true if user tapped yes and false else.
if (App.confirm("Do you want to continue") == true) App.alert('ok');
App.flashlight()
Toggles the flashlight on / off on the phone. Does nothing on the web.App.flashlight();
App.log(String msg)
Logs the msg (string) in the chrome web console on web. On device, logs the message on the Ecclipse log console with ADB.
App.mailto(email)
Starts the email compose application with email as recipient.
App.mailto("john@gmail.com;tony@gmail.com");
App.map(address, geo)
Starts the map application with the address string and optional geo coordinates (lat,long format).
App.map("Paris, France");
App.skype(skypeid)
Starts the skype app with skypeid value to initiate a chat.
App.skype("askypeid");
App.sms(String number, String message)
Starts the sms application with number. If the optional message string parameter is present, it sends the message in the background with no UI interaction.
App.sms("6583 6868")
App.takePicture(linkedtable, linkedid)
Starts the camera capture application and attaches the resulting photo to the record identified by its linkedtable and it linkedid parameter.
App.takePicture("myappid.mytable", recordid);
App.tts(text)
Use phone text to speech engine to speak the text (string) parameter.
App.tts("Hello World");
App.video(youtubeid)
Starts the Youtube application and start playing th video identified by its youtubeid string.
App.video("UF8uR6Z6KLc")
App.web(url)
Starts the web browser and opens the web page at url
App.web("http://www.google.com");
App.writeNfc(func)
Write the func callback function to a NFC Tag. Requires Android. func must be in the form appid.methodname(param)
App.writeNfc("Contacts.viewContact('someid')");
App.scanCode(func)
Initiate a bar code or QRCode scan using rhe built-in phone camera. The func parameter is callback function called by the runtime once a scan has been successfull. Use the this.value parameter to reference the decoded data
QR Code GuideApp.downloadFile(url, postData, filename, useCache)
Downloads a file form a url to the phone local storage.
- url (string) is the aboslute URL to download file from
- postData (string) is an optional POST parameter to be sent during the request
- filename (string) is an optional string to set the local filename of download file. empty or null, the filename is computed from the url
- useCache (integer 0 or 1) indicates if the local file cache must be used or not
- returns the local file path or null if download failed
var fileid= ...; // Some Upvise fileid var useCache = 1; // we want to use cache to avoir redownloading each time var path = App.downloadFile(url, null, useCache); if (path != null) App.openFle(path)
App.downloadFiles(fileids)
Batch downloads all files identified in the fileids parameter. Uses the local file cache to avoid redownloads
- fileds (string) is a pipe separated string of Upvise fileid (from System.files table)
var files = Query.select("System.files", "id", "groupid={somegroupid}"); var fileids = []; for (var i = 0;i < files.length; i++) { fileids.push(files[i].id); } App.downloadFiles(fileids.join("|"));
App.openFile(filepath)
Opens the file identified by its local filepath, using the phone native viewers
- filepath (string) comes from a previous call to App.downloadFile()
var fileid= ...; // Some Upvise fileid var useCache = 1; // we want to use cache to avoir redownloading each time var path = App.downloadFile(url, null, useCache); if (path != null) App.openFle(path)