The Application class is used for accessing or setting application level configuration settings.
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
Path to the ORM database file by partition name. Please note that this function does not create a database file. This function only generates the file path based on the application path and partition name.
Parameters
Partition name.
Synchronous Return:
Full path to the database file for given partition.
Method Access:
Rho.Application.databaseFilePath(STRING partitionName)
Rho::Application.databaseFilePath(STRING partitionName)
Generates the absolute path to database blob file. Please note that this function does not the create database file. This function only generates the file path based on application path and partition name.
Parameters
Relative path to the blob file, as it is stored in the database.
Synchronous Return:
Full path to the database blob.
Method Access:
Rho.Application.expandDatabaseBlobFilePath(STRING relativePath)
Rho::Application.expandDatabaseBlobFilePath(STRING relativePath)
Minimize or move the application to background. When running in RhoSimulator this method is supported only for Windows OS.
Synchronous Return:
Method Access:
Rho.Application.minimize()
Rho::Application.minimize()
Folder of the model by name.
Parameters
Model name.
Synchronous Return:
Method Access:
Rho.Application.modelFolderPath(STRING name)
Rho::Application.modelFolderPath(STRING name)
Ruby applications must use this method for processing of the application Event. May be called from setApplicationNotify callback.This method should be called for each event. The only exception is SyncUserChanged, where you can choose your own reset database logic.
Parameters
See setApplicationNotify for applicationEvent values.
This will only contain values for the APP_EVENT_CONFIGCONFLICT
event. This event may be triggered after an application was upgraded. If your rhoconfig.txt file contains custom properties that are different then what is being provided in the application upgrade package. By default local values are kept in place but you may overwrite configuration with new values and any other steps required for your application upgrade. eventData
will be a hash. It will look like {“conflicting key” : [“new value”,“old value”].. }
Synchronous Return:
Method Access:
Rho::Application.processApplicationEvent(STRING applicationEvent, HASH eventData)
Quit the application.
Synchronous Return:
Method Access:
Rho.Application.quit()
Rho::Application.quit()
Generates the relative path to database blob file. Please note that this function does not create a database file. This function only generates the file path based on the application path and partition name.
Parameters
Absolute path to database blob file.
Synchronous Return:
Method Access:
Rho.Application.relativeDatabaseBlobFilePath(STRING absolutePath)
Rho::Application.relativeDatabaseBlobFilePath(STRING absolutePath)
Restores the application to be in the foreground. When running in RhoSimulator the method is supported only for Windows OS.
Synchronous Return:
Method Access:
Rho.Application.restore()
Rho::Application.restore()
This method allows your application to register for application specific events like application activation/deactivation, UI creation/destruction as well as others. Check the Callback section for details.
Parameters
Async Callback Returning Parameters: HASH
Possible Values :
The application has been activated.
The application has been deactivated. Not supported on iOS.
Generated before the start page is loaded. There are no means to set callback and catch event in JavaScript. Ruby Application class descendant can set callback and process this event.
This event is triggered when the application is closing and the UI has been cleared.
Device screen was turned off when power button was pressed or due to idle timeout. Note: On iOS application is also deactivated (APP_EVENT_DEACTIVATED is fired). On Android the application is not deactivated.Not supported on Windows CE.
Platforms:Android, iOS, WM
Device screen was turned on and unlocked.Not supported on Windows CE.
Platforms:Android, iOS, WM
Event when the current RhoConnect user has changed. This is available under Ruby Only.
This is available under Ruby Only.
This will only contain values for the APP_EVENT_CONFIGCONFLICT
event. This event may be triggered after an application was upgraded. If your rhoconfig.txt file contains custom properties that are different then what is being provided in the application upgrade package. By default local values are kept in place but you may overwrite configuration with new values and any other steps required for your application upgrade. eventData
will be a hash. It will look like {“conflicting key” : [“new value”,“old value”].. }
Synchronous Return:
Method Access:
Rho.Application.setApplicationNotify(CallBackHandler callback)
Rho::Application.setApplicationNotify(CallBackHandler callback)
Path to apps/app folder inside the application bundle.
Property Access:
myObject.appBundleFolder
Application name.
Property Access:
myObject.appName
Path to apps folder inside the application bundle.
Property Access:
myObject.appsBundleFolder
Bad link URI to navigate in browser. This is defined in config.xml: Navigation\BadLinkURI.
Property Access:
myObject.badLinkURI
Path to application bundle folder.
Property Access:
myObject.bundleFolder
Path to the configuration file.
Property Access:
myObject.configPath
Current application country code.
Property Access:
myObject.country
Path to folder where the database blob files are stored. Blobs are usually images or binary files. In the ORM Model you would specify that the attribute is of type blob Ex. When capturing an image, the actual file is saved in the databaseBlobFolder.
Property Access:
myObject.databaseBlobFolder
Native Menu items.
Same values as nativeMenu.
Property Access:
myObject.defaultNativeMenu
Page to navigate to in case of check of SecurityToken failed. Can be set in rhoconfig.txt: invalid_security_token_start_path;
Property Access:
myObject.invalidSecurityTokenStartPath
Current application locale.Like ‘en’, ‘ru’ etc.
Property Access:
myObject.locale
Path to file with the model list.
Property Access:
myObject.modelsManifestPath
Native Menu items. To customise the native application menu and controller menu items in ruby follow Application Menu API
Visible label.
URL to page which will be loaded into tab. It may be path to Ruby controller action; i.e. ‘/app/Account’ would load the Account index action. For ruby callback use ‘callback:/app/Account’ Or JavaScript method to call: ‘javascript: methodOnTab();’. Or path to html page to load.
Property Access:
myObject.nativeMenu
Path to the application’s public folder.
Property Access:
myObject.publicFolder
The version of RhoMobile platform, which was used to build the application.
Property Access:
myObject.rhoPlatformVersion
Indicates if the security token check was failed. Security token can be set in build.yml: security_token. Same security token should be passed as command line parameter ‘-security_token=token_value’ to application. If security token check failed : if this page exist then application navigate to it, otherwise application will exit.
Property Access:
myObject.securityTokenNotPassed
Settings page URI. Will be used when Options menu or toolbar item is chosen by user.
Property Access:
myObject.settingsPageURI
Splash screen image display options. This a string with several parameters divided by ‘;’: delay=5;center;hcenter;vcenter;vzoom;hzoom;zoom.
Property Access:
myObject.splash
Startup page for your application.
Property Access:
myObject.startURI
Define Window caption text. If missed – caption from page used. Not supported on Windows CE devices.
Property Access:
myObject.title
Path to folder where the application can write files and create subfolders.
Property Access:
myObject.userFolder
Version from build time configuration file (build.yml).
Property Access:
myObject.version
There are times where you need access to files bundled with your application, or to write files to a safe folder. These examples show how to retrieve each of the several important folders available.
// Get and show the various app folders var appFolder = Rho.Application.appBundleFolder; var appsBundleFolder = Rho.Application.appsBundleFolder; var databaseBlobFolder = Rho.Application.databaseBlobFolder; var publicFolder = Rho.Application.publicFolder; var userFolder = Rho.Application.userFolder; var message = "App bundle folder: "+appFolder+"\n"+ "Apps bundle folder: "+appsBundleFolder+"\n"+ "Database blob folder: "+databaseBlobFolder+"\n"+ "Public folder: "+publicFolder+"\n"+ "User folder: "+userFolder; alert(message);
# Get and show the various app folders appFolder = Rho::Application.appBundleFolder appsBundleFolder = Rho::Application.appsBundleFolder databaseBlobFolder = Rho::Application.databaseBlobFolder publicFolder = Rho::Application.publicFolder userFolder = Rho::Application.userFolder message = "App bundle folder: "+appFolder+"\n"+ "Apps bundle folder: "+appsBundleFolder+"\n"+ "Database blob folder: "+databaseBlobFolder+"\n"+ "Public folder: "+publicFolder+"\n"+ "User folder: "+userFolder Alert.show_popup(message)
This will minimize your application.
Rho.Application.minimize();
Rho::Application.minimize
This will exit your application.
Rho.Application.quit();
Rho::Application.quit
This will restore you application.
Rho.Application.restore();
Rho::Application.restore