The System API is used to control and modify core aspects of the device such as the screen, OS and device capabilities.
This API is part of the coreapi
extension that is included automatically.
extensions: ["coreapi"]
Be sure to review the JavaScript API Usage guide for important information about using this API in JavaScript
Be sure to review the Ruby API Usage guide for important information about using this API in Ruby
Install an application.
Parameters
The url of an application to install on the device.
Synchronous Return:
Method Access:
Rho.System.applicationInstall(STRING applicationUrl)
Rho::System.applicationInstall(STRING applicationUrl)
Uninstall the application. Not Supported on Windows CE devices.
Parameters
The name of the application.
Synchronous Return:
Method Access:
Rho.System.applicationUninstall(STRING applicationName)
Rho::System.applicationUninstall(STRING applicationName)
Bring application window to the top of the screen.
Synchronous Return:
Method Access:
Rho.System.bringToFront()
Rho::System.bringToFront()
Use Network.clearStatusNotify: Clear network status callback.
Synchronous Return:
Method Access:
Rho.System.clearNetworkStatusNotify()
Rho::System.clearNetworkStatusNotify()
Delete folder.
Parameters
Path to folder.
Synchronous Return:
Method Access:
Rho.System.deleteFolder(STRING pathToFolder)
Rho::System.deleteFolder(STRING pathToFolder)
Deletes the specified value from the device registry. Only applicable on Windows Mobile / Embedded Handheld and CE devices. When running on RhoSimulator, this method is supported only for Windows OS.
Parameters
Map of properties associated with the registry key being set
The hive name, setRegistrySetting
Full path of the key, including '\' separators as required. Remember to use '\\' in JavaScript to specify backslash
The name of the setting to be deleted
If the registry value was set to be persistent, ie a corresponding .reg file was created in the \Application folder then setting true here will delete that .reg file.
Synchronous Return:
Method Access:
Rho.System.deleteRegistrySetting(HASH propertyMap)
Rho::System.deleteRegistrySetting(HASH propertyMap)
Use Application.quit: exit application.
Synchronous Return:
Method Access:
Rho.System.exit()
Rho::System.exit()
This method will return all of object/value pairs for the propertyNames of the API class.
Parameters
Async Callback Returning Parameters: HASH
Synchronous Return:
Method Access:
Rho.System.getAllProperties(CallBackHandler callback)
Rho::System.getAllProperties(CallBackHandler callback)
This method will return a set of object/value pairs for the list of the propertyName that is passed in. The propertyNames must be a valid property of the API class.
Parameters
List of properties I want to know about
Async Callback Returning Parameters: HASH
Synchronous Return:
Method Access:
Rho.System.getProperties(ARRAY arrayofNames, CallBackHandler callback)
Rho::System.getProperties(ARRAY arrayofNames, CallBackHandler callback)
This method will return the value of the propertyName that is passed in. The propertyName must be a valid property of the API class.
Parameters
The property to return info about.
Async Callback Returning Parameters: STRING
Synchronous Return:
Method Access:
Rho.System.getProperty(STRING propertyName, CallBackHandler callback)
Rho::System.getProperty(STRING propertyName, CallBackHandler callback)
Retrieve a value from the device registry. Only applicable on Windows Mobile / Embedded Handheld and CE devices. When running on RhoSimulator, this method is supported only for Windows OS.
Parameters
Map of properties associated with the registry key being set
The hive name, see setRegistrySetting
Full path of the key, including '\' separators as required. Remember to use '\\' in JavaScript to specify backslash
The name of the setting to be retrieved
Synchronous Return:
Method Access:
Rho.System.getRegistrySetting(HASH propertyMap)
Rho::System.getRegistrySetting(HASH propertyMap)
Return the command line parameters. At Android start parameters are returned as URL query string starting with ‘?’, name-value delimiter ‘=’ and name value pairs delimiter ‘&’.
Synchronous Return:
Method Access:
Rho.System.getStartParams()
Rho::System.getStartParams()
Use System.locale property: Current device locale.
Synchronous Return:
Method Access:
Rho.System.get_locale()
Rho::System.get_locale()
Checks if the specified applicationName is installed on the device
Parameters
The name of the application.
Synchronous Return:
Method Access:
Rho.System.isApplicationInstalled(STRING applicationName)
Rho::System.isApplicationInstalled(STRING applicationName)
Use Database.SQLite3.isBlobAttr: is model attribute is blob.
Parameters
Synchronous Return:
Method Access:
Rho.System.isBlobAttr(STRING partition, INTEGER sourceID, STRING attrName)
Rho::System.isBlobAttr(STRING partition, INTEGER sourceID, STRING attrName)
Open the application associated with the URL. Behavior may be different on different platforms and depend on installed software. For example, open URL with http:// prefix will execute the Web Browser installed on system and open URL in executed browser..
Parameters
URL as string.
Synchronous Return:
Method Access:
Rho.System.openUrl(STRING url)
Rho::System.openUrl(STRING url)
Replace application bundle.
Parameters
Local path to bundle folder. See Build Application/Upgrade Application section to find out how to build bundle on computer.
Update parameters.
If true, when Application will not be automatically restarted after the replace bundle is finished
Synchronous Return:
Method Access:
Rho.System.replaceCurrentBundle(STRING pathToBundle, HASH params)
Rho::System.replaceCurrentBundle(STRING pathToBundle, HASH params)
Run an application.
Parameters
The name of the application on the device to run. It depends from platform. On iOS it is BundleURLScheme of executed application.
String with any content. Executed Application can receive this string by getStartParams method. Parameter could be just value, or key-value pair separated by '=' sign. Please note that for each platform there are distinct ways to write several params at once. On Android parameters should be separated by "&", on other platforms by ',' or ' '.
The name of the application on the device to run.Not Implemented. False by default
Synchronous Return:
Method Access:
Rho.System.runApplication(STRING appName, STRING params, BOOLEAN blockingCall)
Rho::System.runApplication(STRING appName, STRING params, BOOLEAN blockingCall)
Set do not backup attribute for file.
Parameters
Path to file.
true set doNotBackup attribute to file (exlude this file from backup), false for remove doNotBackup attribute from file
Synchronous Return:
Method Access:
Rho.System.setDoNotBackupAttribute(STRING pathToFile, BOOLEAN doNotBackup)
Rho::System.setDoNotBackupAttribute(STRING pathToFile, BOOLEAN doNotBackup)
Use Network.setStatusNotify: set network notification callback.
Parameters
The url to the user-defined callback method.
iOS. The network status polling period for systems that can not notify network status change immediately. Default value is 20 seconds.
Synchronous Return:
Method Access:
Rho.System.setNetworkStatusNotify(STRING url, INTEGER poll_interval)
Rho::System.setNetworkStatusNotify(STRING url, INTEGER poll_interval)
This method will set the values of a list of properties for the API class. The propertyName must be a valid property for the class and must also not be read only.
Parameters
Map of properties I want to set
Synchronous Return:
Method Access:
Rho.System.setProperties(HASH propertyMap)
Rho::System.setProperties(HASH propertyMap)
This method will set the value of a property for the API class. The propertyName must be a valid property for the class and must also not be read only.
Parameters
The one property name that I want to set
The one property value that I want to set
Synchronous Return:
Method Access:
Rho.System.setProperty(STRING propertyName, STRING propertyValue)
Rho::System.setProperty(STRING propertyName, STRING propertyValue)
Use Push.setPushNotification: Register push callback, the method to call upon receiving a push message.
Parameters
URL of the callback method. If empty, unregisters rhoconnect-push.
Params which will be added to callback URL.
Name of a push service client. Current values can be 'rhoconnect_push' or 'gcm' or 'legacy' or empty. The call will be applied to every push client.
Synchronous Return:
Method Access:
Rho.System.setPushNotification(STRING url, STRING url_params, STRING push_client)
Rho::System.setPushNotification(STRING url, STRING url_params, STRING push_client)
Set a value in the device registry. Only applicable on Windows Mobile / Embedded Handheld and CE devices. When running on RhoSimulator, this method is supported only for Windows OS.
Parameters
Map of properties associated with the registry key being set
The hive name
Possible Values :
The type
Possible Values :
Full path of the key, including '\' separators as required. Remember to use '\\' in JavaScript to specify backslash
The name of the registry setting to be set
The registry value to be set
Whether or not to create a corresponding merge file, setting to true will cause your value to persist across a device clean boot. A .reg file is written to the \Application folder on the device to persist the setting.
Synchronous Return:
Method Access:
Rho.System.setRegistrySetting(HASH propertyMap)
Rho::System.setRegistrySetting(HASH propertyMap)
Use ScreenOrientation.setScreenOrientationEvent: Notify (call a callback method) when the screen rotates.
Parameters
URL of the callback method. If empty, unregisters notification callback.
Params which will be added to callback URL.
Synchronous Return:
Method Access:
Rho.System.setScreenRotationNotification(STRING url, STRING url_params)
Rho::System.setScreenRotationNotification(STRING url, STRING url_params)
Change application window position and size
Parameters
Left corner of window.
Top corner of window.
Width of window.
Height of window.
Synchronous Return:
Method Access:
Rho.System.setWindowFrame(INTEGER x, INTEGER y, INTEGER width, INTEGER height)
Rho::System.setWindowFrame(INTEGER x, INTEGER y, INTEGER width, INTEGER height)
Change application window position
Parameters
Left corner of window.
Top corner of window.
Synchronous Return:
Method Access:
Rho.System.setWindowPosition(INTEGER x, INTEGER y)
Rho::System.setWindowPosition(INTEGER x, INTEGER y)
Change application window size
Parameters
Width of the window.
Width of the of window.
Synchronous Return:
Method Access:
Rho.System.setWindowSize(INTEGER width, INTEGER height)
Rho::System.setWindowSize(INTEGER width, INTEGER height)
Use System.applicationIconBadge: Set the application icon to have this badge number. Set to 0 (zero) to remove badge.iOS only.
Parameters
Synchronous Return:
Method Access:
Rho.System.set_application_icon_badge(INTEGER badgeNumber)
Rho::System.set_application_icon_badge(INTEGER badgeNumber)
Use System.httpProxyURI property: To use client with the HTTP proxy
Parameters
Synchronous Return:
Method Access:
Rho.System.set_http_proxy_url(STRING proxyURI)
Rho::System.set_http_proxy_url(STRING proxyURI)
Use Application.setLocale method: set application specific locale
Parameters
Synchronous Return:
Method Access:
Rho.System.set_locale(STRING locale_code, STRING country_code)
Rho::System.set_locale(STRING locale_code, STRING country_code)
Use System.screenSleeping property: enable/disable phone sleeping.
Parameters
Synchronous Return:
Method Access:
Rho.System.set_sleeping(BOOLEAN enable)
Rho::System.set_sleeping(BOOLEAN enable)
Use Timer.start: start timer.
Parameters
Timer interval.
URL of the callback method.
Params which will be added to callback URL.
Synchronous Return:
Method Access:
Rho.System.startTimer(INTEGER interval, STRING url, STRING url_params)
Rho::System.startTimer(INTEGER interval, STRING url, STRING url_params)
Use Timer.stop: stop timer.
Parameters
URL of the callback method which identify the timer to stop.
Synchronous Return:
Method Access:
Rho.System.stopTimer(STRING url)
Rho::System.stopTimer(STRING url)
Use System.httpProxyURI property: Stop using HTTP proxy that was set by the command line, rhoconfig.txt or set_http_proxy_url.
Synchronous Return:
Method Access:
Rho.System.unset_http_proxy()
Rho::System.unset_http_proxy()
Unzip file.
Parameters
The path to the file to be unzipped. Application should have write permissions to this folder.
Password for the zip.
Synchronous Return:
Method Access:
Rho.System.unzipFile(STRING localPathToZip, STRING password)
Rho::System.unzipFile(STRING localPathToZip, STRING password)
Use Database.updateBlobAttribs: update model blob attributes list.
Parameters
Synchronous Return:
Method Access:
Rho.System.updateBlobAttribs(STRING partition, INTEGER sourceID)
Rho::System.updateBlobAttribs(STRING partition, INTEGER sourceID)
Zip one file. Zip archive must placed to the folder where application can write files.
Parameters
The path to the specified zip. Application should have write permissions to this folder.
The path to the file to be zipped.
Password for the zip.
Synchronous Return:
Method Access:
Rho.System.zipFile(STRING localPathToZip, STRING localPathToFile, STRING password)
Rho::System.zipFile(STRING localPathToZip, STRING localPathToFile, STRING password)
Zip list of files.
Parameters
The path to the specified zip.
Base path to the files to be zipped.
List of file paths to be zipped.
Password for the zip.
Synchronous Return:
Method Access:
Rho.System.zipFiles(STRING localPathToZip, STRING basePath, ARRAY filePathsToZip, STRING password)
Rho::System.zipFiles(STRING localPathToZip, STRING basePath, ARRAY filePathsToZip, STRING password)
Property Access:
Rho.System.applicationIconBadge
Rho::System.applicationIconBadge
Property Access:
Rho.System.country
Rho::System.country
Property Access:
Rho.System.deviceName
Rho::System.deviceName
Property Access:
Rho.System.deviceOwnerEmail
Rho::System.deviceOwnerEmail
Property Access:
Rho.System.deviceOwnerName
Rho::System.deviceOwnerName
Property Access:
Rho.System.devicePushId
Rho::System.devicePushId
Property Access:
Rho.System.freeServerPort
Rho::System.freeServerPort
Property Access:
Rho.System.hasCalendar
Rho::System.hasCalendar
Property Access:
Rho.System.hasCamera
Rho::System.hasCamera
Property Access:
Rho.System.hasCellNetwork
Rho::System.hasCellNetwork
Property Access:
Rho.System.hasNetwork
Rho::System.hasNetwork
Property Access:
Rho.System.hasSqlite
Rho::System.hasSqlite
Property Access:
Rho.System.hasTouchscreen
Rho::System.hasTouchscreen
Property Access:
Rho.System.hasWifiNetwork
Rho::System.hasWifiNetwork
Property Access:
Rho.System.httpProxyURI
Rho::System.httpProxyURI
Property Access:
Rho.System.isEmulator
Rho::System.isEmulator
Property Access:
Rho.System.isMotorolaDevice
Rho::System.isMotorolaDevice
Property Access:
Rho.System.isRhoSimulator
Rho::System.isRhoSimulator
Default: See Description
Possible Values (STRING):
Property Access:
Rho.System.keyboardState
Rho::System.keyboardState
Default: 8080
Property Access:
Rho.System.localServerPort
Rho::System.localServerPort
Property Access:
Rho.System.locale
Rho::System.locale
Default: false
Property Access:
Rho.System.lockWindowSize
Rho::System.lockWindowSize
Property Access:
Rho.System.oemInfo
Rho::System.oemInfo
Property Access:
Rho.System.osVersion
Rho::System.osVersion
Property Access:
Rho.System.phoneId
Rho::System.phoneId
Possible Values (STRING):
Property Access:
Rho.System.platform
Rho::System.platform
Property Access:
Rho.System.ppiX
Rho::System.ppiX
Property Access:
Rho.System.ppiY
Rho::System.ppiY
Property Access:
Rho.System.realScreenHeight
Rho::System.realScreenHeight
Property Access:
Rho.System.realScreenWidth
Rho::System.realScreenWidth
Default: true
Property Access:
Rho.System.screenAutoRotate
Rho::System.screenAutoRotate
Property Access:
Rho.System.screenHeight
Rho::System.screenHeight
Possible Values (STRING):
Property Access:
Rho.System.screenOrientation
Rho::System.screenOrientation
Property Access:
Rho.System.screenSleeping
Rho::System.screenSleeping
Property Access:
Rho.System.screenWidth
Rho::System.screenWidth
Property Access:
Rho.System.uuid
Rho::System.uuid
Property Access:
Rho.System.webviewFramework
Rho::System.webviewFramework
// Returns true if device supports Zebra device capabilities, such as Scanner, etc. var is_motorola_device = Rho.System.isMotorolaDevice; var has_calendar = Rho.System.hasCalendar; var has_camera = Rho.System.hasCamera; var has_cell_network = Rho.System.hasCellNetwork; var has_wifi_network = Rho.System.hasWifiNetwork; var has_network = Rho.System.hasNetwork; var has_sqlite = Rho.System.hasSqlite; var has_touchscreen = Rho.System.hasTouchscreen; message = "Zebra device: "+is_motorola_device+"\n"+ "Calendar: "+has_calendar+"\n"+ "Camera: "+has_camera+"\n"+ "Cell network: "+has_cell_network+"\n"+ "WiFi: "+has_wifi_network+"\n"+ "Network: "+has_network+"\n"+ "SQLite: "+has_sqlite+"\n"+ "Touchscreen: "+has_touchscreen; alert(message);
# Returns true if device supports Zebra device capabilities, such as barcode scanner, etc. is_motorola_device = Rho::System.isMotorolaDevice has_calendar = Rho::System.hasCalendar has_camera = Rho::System.hasCamera has_cell_network = Rho::System.hasCellNetwork has_wifi_network = Rho::System.hasWifiNetwork has_network = Rho::System.hasNetwork has_sqlite = Rho::System.hasSqlite has_touchscreen = Rho::System.hasTouchscreen message = " Zebra device: #{is_motorola_device} Calendar: #{has_calendar} Camera: #{has_camera} Cell network: #{has_cell_network} WiFi: #{has_wifi_network} Network: #{has_network} SQLite: #{has_sqlite} Touchscreen: #{has_touchscreen} " Alert.show_popup(message)
var version_info = Rho.System.osVersion;
alert(version_info);
version_info = Rho::System.osVersion Alert.show_popup(version_info)
// install an application from given url Rho.System.applicationInstall("/bin/target/android/rhodes-app-debug.apk"); // uninstall the application Rho.System.applicationUninstall("rhodes-app");
#install an application from given url Rho::System.applicationInstall("/bin/target/android/rhodes-app-debug.apk") # uninstall the application Rho::System.applicationUninstall("rhodes-app")
// Get port of the local (embedded) HTTP server var local_port = Rho.System.localServerPort; alert(local_port);
# Get port of the local (embedded) HTTP served local_port = Rho::System.localServerPort() Alert.show_popup(local_port)
// unzip file Rho.System.unzipFile("/app/public/sample.zip"); // zip file Rho.System.zipFile("/app/public/zipfile.zip", "/app/public/sample.txt");
# unzip a file Rho::System.unzipFile("/app/public/sample.zip") # zip a file Rho::System.zipFile("/app/public", "/app/public/sample.txt")
#/app/Model # Retrieve a value from the Registry def get_registry_sync theRegSetting = Rho::System.getRegistrySetting({hive:'HKLM', key:'software', Setting:'RhoElementsTest'}) puts "Registry Setting retrieved: #{theRegSetting}" end # Set a value in the registry which will persist across a clean boot of the device def set_registry_sync theRegSetting = Rho::System.setRegistrySetting({hive:'HKLM', type:'String', key:'Software', setting:'RhoElementsTest', value:'MVC ftw', persistent:true}) puts "Registry Setting Success?: #{theRegSetting}" end # Delete a value from the registry def delete_registry_sync theRegSetting = Rho::System.deleteRegistrySetting({hive:'HKLM', key:'Software', setting:'RhoElementsTest', persistent:true}) puts "Registry Deleting Success?: #{theRegSetting}" end