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 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 tab for details.
Parameters
Async Callback Returning Parameters: HASH
Possible Values :
The application has been activated.
The application has been deactivated.
Generated before the start page is loaded. There are no means to set callback and catch event in javascript. Ruby Application class descendant can to 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. NB: 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 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:
Rho.Application.appBundleFolder
Rho::Application.appBundleFolder
Application name.
Property Access:
Rho.Application.appName
Rho::Application.appName
Path to apps folder inside the application bundle.
Property Access:
Rho.Application.appsBundleFolder
Rho::Application.appsBundleFolder
Bad link URI to navigate in browser. This is defined in config.xml: Navigation\BadLinkURI.
Property Access:
Rho.Application.badLinkURI
Rho::Application.badLinkURI
Path to application bundle folder.
Property Access:
Rho.Application.bundleFolder
Rho::Application.bundleFolder
Path to the configuration file.
Property Access:
Rho.Application.configPath
Rho::Application.configPath
Current application country code.
Property Access:
Rho::Application.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:
Rho.Application.databaseBlobFolder
Rho::Application.databaseBlobFolder
Native Menu items.
Same values as nativeMenu.
Property Access:
Rho.Application.defaultNativeMenu
Rho::Application.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:
Rho.Application.invalidSecurityTokenStartPath
Rho::Application.invalidSecurityTokenStartPath
Current application locale.Like ‘en’, ‘ru’ etc.
Property Access:
Rho::Application.locale
Path to file with the model list.
Property Access:
Rho.Application.modelsManifestPath
Rho::Application.modelsManifestPath
Native Menu items.
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:
Rho.Application.nativeMenu
Rho::Application.nativeMenu
Path to the application’s public folder.
Property Access:
Rho.Application.publicFolder
Rho::Application.publicFolder
Is 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:
Rho.Application.securityTokenNotPassed
Rho::Application.securityTokenNotPassed
Settings page URI. Will be used when Options menu or toolbar item is chosen by user.
Property Access:
Rho.Application.settingsPageURI
Rho::Application.settingsPageURI
Splash screen image display options. This a string with several parameters divided by ‘;’: delay=5;center;hcenter;vcenter;vzoom;hzoom;zoom.
Property Access:
Rho.Application.splash
Rho::Application.splash
Startup page for your application.
Property Access:
Rho.Application.startURI
Rho::Application.startURI
Define Window caption text. If missed – caption from page used. Not supported on Windows CE devices.
Property Access:
Rho.Application.title
Rho::Application.title
Path to folder where the application can write files and create subfolders.
Property Access:
Rho.Application.userFolder
Rho::Application.userFolder
Version from build time configuration file (build.yml).
Property Access:
Rho.Application.version
Rho::Application.version
If your application is internationalized, you may want to set the locale depending on the user’s preference.
Rho.Application.setLocale('en') var current_locale = Rho.Application.locale(); alert(current_locale)
Rho::Application.setLocale('en') current_locale = Rho::Application.locale Alert.show_popup(current_locale)
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