Application API

The Application API provides functions that enable you to control the application-level events and behaviors of your app.

The Application API uses kony.application namespace and the following API elements:

Constants

Constant Type Description
Application Constants Identifies the location from where the app is launched.
Breakpoint Constants Checks if the current browser window size has gone beyond highest value of breakpoints list defined.
Runtime Permissions Constants Report the status of runtime permissions.
 

Functions

Function Description
kony.application.addApplicationCallbacksHelps you to register multiple callbacks for the same event.
kony.application.addBMStateAdds a specified key and value to the parameter list of the URL of the form.
kony.application.addGestureRecognizerForAllFormsEnables the developers to set a gesture recognizer for all the forms.
kony.application.addSettingsMenuItemAt Enables you to add a menu item at a given index in the Charm settings menu.
kony.application.beginBackgroundTaskUsed when you want to run a long running or the asynchronous task in the background of the phone app.
kony.application.checkPermissionChecks and returns the permission status of one or more resources.
kony.application.createSettingsMenuEnables you to create a Charm settings menu for an application.
kony.application.dismissLoadingScreenProvides you the ability to dismiss the loading screen displayed earlier
kony.application.destroyFormDestroys the target form.
kony.application.disableZoomedOutView Enables you to disable a zoomed out view set for an application using the previous API.
kony.application.endBackgroundTask Invoked when you are done with an execution of long running tasks in the background.
kony.application.exitTerminates the application.
kony.application.exitLibrary Provides you the ability to exit the library. After exiting the library, the control moves to the Native app UI.
kony.application.getApplicationBadgeValueEnables you to read the badge value (if any) attached to the given application icon.
kony.application.getApplicationNotificationSettingsEnables an application on a device to get Push Notifications Settings status.
kony.application.getApplicationModeEnables you to get the application mode.
kony.application.getApplicationStateChecks whether the app is running in the background or not to make UI updates.
kony.application.getAppMenuBadgeValueEnables you to read the badge value (if any) attached to the specified app menu item.
kony.application.getAppWindowReturns a handle to an AppWindow object.
kony.application.getBMStateRetrieves the list of parameters attached to a URL using the above add, set APIs.
kony.application.getCurrentBreakpointReturns the current breakpoint value.
kony.application.getCurrentFormReturns a handle to the current form.
kony.application.getCurrentSettingsMenuReturns the unique identifier of the current menu that is set through getCurrentSettingsMenu.
kony.application.getInstallerSourceInfoReturns the package name from which the application was installed.
kony.application.getPreviousFormReturns a handle to the previous form.
kony.application.getPreviousSessionParamsRetrieves the previous session parameters in the application life cycle.
kony.application.getSettingValueRetrieves the current device settings.
kony.application.invalidateSessionInvalidates a session on Mobile Web.
kony.application.isIgnoringBatteryOptimizationsChecks whether the current application is present in the power white-list of the device.
kony.application.isImageTurnedOff Gets the status of image settings, which are defined by a particular user, in a web browser.
kony.application.isInMultiWindowMode Returns true if the application is in multi-window mode, and the function returns false if the application is in full-screen mode.
kony.application.isPopupBlocked Gets the status of pop-up settings, which are defined by a particular user, in a web browser.
kony.application.launchApp Launches the application specified by the input URL.
kony.application.launchBatteryOptimizationSettingsLaunches the settings screen of the device that displays options to control the battery optimization behavior of the app.
kony.application.openApplicationSettingsOpens the application-specific settings or device-level application settings.
kony.application.openMediaURLLaunches the native media player and starts playing the media (audio or video) at the specified URL.
kony.application.openURL Opens the web page at the specified URL in the native browser of the mobile device.
kony.application.openURLAsyncOpens the web page at the specified URL in the native browser of the mobile device.
kony.application.postAccessibilityNotificationPosts a notification to "assistive" applications
kony.application.recommendAppRecommends an App Store Application on iOS devices.
kony.application.registerForIdleTimeoutSpecifies if the application must timeout after a defined period of inactivity and also specifies the action after the timeout interval.
kony.application.registerOnKeyPress Connects an event handler function to a key press event.
kony.application.registerOnSettingsChangeCallbackListens if any settings have been changed in Native settings applications.
kony.application.removeApplicationCallbacks Helps you to clear callback functions associated with the specified appstates.
kony.application.removeBMStateRemoves a specified key from the parameter list of the URL of the form.
kony.application.removeGestureRecognizerForAllForms Enables you to remove a specified gesture recognizer for all Forms.
kony.application.removeSecondaryTileEnables you to remove and unpin a specified secondary tile which was created earlier.
kony.application.removeSeoDataReadyFlagClears the flag that caches forms for SEO.
kony.application.removeSettingsMenuItemAtEnables you to removes the specified App Menu item based on the index.
kony.application.requestIgnoreBatteryOptimizations Displays a dialog box with the ALLOW and DENY options to control the battery optimization state for an app, without having to open the device settings.
kony.application.requestPermissionRequests for the end-user consent to access a particular resource.
kony.application.requestPermissionSet Sends a request for a set of permissions. The status of the request is sent back to the user through a callback.
kony.application.requestReview Requests users to provide a rating and to write a review for an app.
kony.application.resetBMStateResets the state associated with the URL of a form.
kony.application.sendLibraryResultToNativeAppEnables you to send an acknowledgment to a Native app that launched this library.
kony.application.setAppLevelWidgetConfigures a container widget at the application level that can either be used as a header or a footer throughout the app.
kony.application.setApplicationBehaviorsEnables your app to configure its response to various events.
kony.application.setApplicationBadgeValueEnables you to set a badge value to an application icon on the mobile desktop at the top-right corner of the application icon.
kony.application.setApplicationCallbacksCaptures the callback events for various states of the application
kony.application.setApplicationInitializationEventsConfigures all initialization events such as, preappinit, postappinit, init, appservice, showstartupform and so on.
kony.application.setApplicationLayoutSpecifies if the application must have a layout from "left to right" or "right to left".
kony.application.setApplicationModeEnables you to set the application mode to Native, Hybrid, or Wrapper.
kony.application.setApplicationPropertiesEnables you to set properties at the application level.
kony.application.setAppMenuBadgeValue Enables you to set a badge value to the specified app menu item on the top-right corner of the app menu item.
kony.application.setAppTileEnables you to set the data for an application tile.
kony.application.setBMState Sets the bookmark state to the URL.
kony.application.setCheckBoxSelectionImageAlignment Used to set the alignment of the checkBox selection image.
kony.application.setCurrentSettingsMenuUses the unique identifier which represents the Charm settings menu and sets it as current settings menu.
kony.application.setCurrentAppMenuFont Sets the font name and font size of various app menu items in the current app menu.
kony.application.setDefaultListboxPaddingCustomizes the default paddings applied for a ListBox.
kony.application.setDefaultTextboxPaddingCustomizes the default paddings applied for a Textbox.
kony.application.setLibraryHeadlessModeCallbackRegisters a listener or a callback that receives request from a Native app to launch Quantum library without UI or in headless mode.
kony.application.setRespectImageSizeForImageWidgetAlignmentSets the ImageWidget width to minimum or maximum according to available width or image width in absence of reference width
kony.application.setSecondaryTile Enables you to create or update data for a secondary tile for an application.
kony.application.setSeoDataReadyFlagSets a flag indicating that the current form is ready to be cached for search engine optimization.
kony.application.setZoomedOutViewEnables you to set a form to be shown to the user when a zoom out gesture is performed.
kony.application.showLoadingScreenEnables you to display a loading screen (following a certain color schema) to the user while another action is in progress.
kony.application.startForegroundServiceDefines the notifications for an app that is running in the background, i.e, an app with which the user is not interacting directly.
kony.application.stopForegroundServiceEnables you to stop the foreground service for an application that is running in the background.
kony.application.unregisterForIdleTimeoutSpecifies that the application must not timeout after a defined period of inactivity (time difference between the current device time and the last time you clicked on any user interface component).
kony.application.updateForegroundNotificationEnables you to customize and update the existing notifications shown by the foreground service.
kony.application.zoomInEnables you to zoom in on an application programmatically.

Overview

This functions in the Application API handle such tasks as setting application callbacks, starting and stopping background tasks, showing and dismissing the loading screen, and so forth.

NOTE: All of the Application API functions are in the kony.application namespace. However, the kony.application namespace contains some functions that are not part of the Application API. Only the functions listed above are part of the Application API.

During the lifecycle of an application, the mobile device usually triggers several events. The functions in the Application API allow you to listen for these events and override them with application-specific functionality. Your app should register for application events during the application load event of the project or masterdataload event of the startup form.