Skip to main content

         This documentation site is for previous versions. Visit our new documentation site for current releases.      

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Custom Pega Mobile Client modules for the Android platform

Updated on September 3, 2019

Custom Pega® Mobile Client modules for the Android platform are developed in Java and expose their functionality through the JavaScript API. Custom modules enable features and functions that are available to native Android applications in Pega Platform custom mobile apps. Custom modules contain one or more JavaScript plug-in classes. They can also contain actvity plug-in classes.

As an Android developer, you can integrate custom modules with Pega Mobile Client by using dependencies on existing product modules, as well as increase their versatility by including third-party libraries. After developing a custom module in an external development environment, you can compile, debug, and test the module before building the final application.

Distribution package

The distribution package is a .zip file that you can obtain from your Pegasystems Global Customer Support representative. The file contains the required resources for building a Pega Mobile Client-based custom mobile app, such as libraries, product modules, documentation, scripts, styles, and graphic files.

JavaScript plug-in classes

JavaScript plug-in classes use a bridge between JavaScript and the native side to respond to JavaScript requests and fire JavaScript events. On the Android platform, JavaScript plug-in classes must extend the abstract. Classes that extend this abstract are instantiated for each WebView instance when the instance is created, and remain valid within the context of this instance for the instance lifetime.

During the application-building phase, you place all the assets that are related to the JavaScript plug-in class in a directory in the Android application (for example, assets). This is where you must direct the JavascriptAppender appender to load the JavaScript implementation. The appender uses assets as its base directory.

JavaScript code that is returned by JavaScript plug-in classes is injected into the WebView during the startup of the web application, before the onLaunchboxLoaded method is called. An instance of the bridge object is available during the injection phase. JavaScript code must use this instance to communicate with the native code.

To learn how to create JavaScript plug-in classes, see Extending Pega Mobile Client with additional JavaScript plug-in classes.

Activity plug-in classes

To extend the Pega Mobile Client, for example, to grant the custom mobile app access to activity life cycle events, you can use actvity plug-in classes. Custom modules can contain one or more such classes. Activity plug-in classes must implement the basic abstract that is provided by the API in the /extensions/API directory of the distribution package. Implemented methods are called in response to activity life cycle events, which are described in the Android APIs reference. An activity plug-in class enables simple initialization such as creating singleton instances or registering for Android activity events. Its instance is created once, at client startup, and remains valid within the context of the client for its lifetime. If the library of the custom module contains more than one activity plug-in class, Pega Mobile Client creates an instance for each of them.

To learn how to create activity plug-in classes, see Extending Pega Mobile Client with activity plug-in classes.

Dependencies on product modules

Pega Mobile Client consists of several product modules. The Base module contains the basic functionality of the Pega Mobile Client and is a required dependency. For the custom module to have dependencies on modules other than the Base module, you must add a dependency in the build.gradle file that is in your custom module directory, for example:
compile 'com.pega:barcodeScanner:+'

All Pega Mobile Client modules are in a local Maven repository, in the repository directory of the Android Studio project.

For more information, see Adding third-party dependencies.

Source-code versus compiled custom modules

Custom Pega Mobile Client modules in a source-code format are easier to package than compiled ones. However, transferring them and building the app in the Pega Platform takes longer. Binary custom modules help you save time when transferring the files and compiling the app. Using the compiled (binary) form is the preferred method to deliver custom modules.

For more information about packaging custom modules in source-code and binary form, see Packaging the custom module.

Android 6 permission model

Pega Mobile Client supports the run-time permission model that was introduced in Android 6. The user of an app is asked to accept permissions at run time and can revoke certain permissions later. You must list the permissions in the AndroidManifest.xml file of your custom module, and review the permission status every time you want to use it.

Pega Mobile Client provides a simplified API to support the new permission mechanism. This API is transparent for devices that do not support this functionality. To become familiar with the API, review the Javadoc information that is provided in the distribution package.

For short usage instructions, see Requesting a permission to perform an action.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best. is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us