Live Update


User segmentation is the practice of dividing users into groups that reflect similarity among users in each group. A common example is geographic segmentation, that is, dividing users on a geographical basis. The goal of segmenting users is to decide how to relate to them in each segment in order to maximize value.

The Live Update feature in PMF provides a simple way to define and serve different configurations for each segment of users of an application. It includes a component in the PMF Operations Console for defining the structure of the configuration as well as the values of the configuration for each segment. Also provided is a client SDK (available for Android and iOS native and for Cordova applications) for consuming the configuration.

Common Use Cases

Live Update supports defining and consuming segment-based configurations, making it easy to make segment-based customizations to the application. Common use cases can be:

  • Release trains and feature flipping
  • A/B testing
  • Context-based customization of the application (e.g. geographic segmentation)

Jump to:

Live Update Architecture

The following system components function together in order to provide the Live Update functionality.

  • Live Update adapter: an adapter which provides:
  • Application schema and segments management
  • Serving configurations to applications
  • Client-side SDK: the Live Update SDK is used to retrieve and access configuration elements such as features and properties from the PMF.
  • PMF Operations Console: used for configuring the Live Update adapter and settings.
  • Configuration Service: Internal. Provides configuration management services for the Live Update adapter.

Adding Live Update to PMF

By default, Live Update Settings in the PMF Operations Console is hidden. To enable, the provided Live Update adapter needs to be deployed.

  1. Open the PMF Operations Console. From the sidebar navigation click on Download Center → Tools tab.
  2. Download and deploy the Live Update adapter.

Once deployed, the Live Update Settings screen is then revealed for each registered application.

Configuring Application Security

In order to allow integration with Live Update, a scope element is required. Without it, the adapter will reject requests from client applications.

Load the PMF Operations Console and click on [your application] → Security tab → Scope-Elements Mapping. Click New and enter the scope element configuration-user-login. Then, click Add.

You can also map the scope element to a security check in case you are using one in your application.

Learn more about the PMF security framework

Schema and Segments

Two tabs are available in the Live Update Settings screen:

What is Schema

A schema is where features and properties are defined.

  • Using “features” you can define configurable application features and set their default value.
  • Using “properties” you can define configurable application properties and set their default value.

Segments

Segments define unique application behaviors by customizing the default features and properties defined by the schema.

Adding Schema and Segments

Before adding a schema and segments for an applicaiton, the developer or product management team need to reach a decision about several aspects:

  • The set of features to utilize Live Update for as well as their default state
  • The set of configurable string properties and their default value
  • The market segments for the application

For each market segment it should be decided:

  • What is the state of every feature, and how this state can change during the application lifetime
  • What is the value of every property, and how this value can change during the application lifetime


Once the parameters are decided upon, Schema features & properties and Segments can be added.
To add, click New and provide the requested values.

Review schema terminology

  • Feature: A feature determines if some part of the application functionality is enabled or disabled. When defining a feature in the schema of an application the following elements should be provided:
    • id – A unique feature identifier. String, Non-editable.
    • name - A descriptive name of the feature. String, Editable.
    • description – A short description of the feature. String, Editable.
    • defaultValue – The default value of the feature that will be served unless it was overridden inside the segment (see Segment below). Boolean, Editable.
  • Property: A property is a key:value entity that can be used to customize applications. When defining a property in the schema of an application the following elements should be provided:
    • id – A unique property identifier. String, Non-editable.
    • name - A descriptive name of a property. String, Editable.
    • description – A short description of the property. String, Editable.

Define Schema features and properties with default values

Adding Live Update SDK to applications

The Live Update SDK provides developers with API to query runtime configuration features and properties that were previously defined in the Live Update Settings screen of the registered application in the PMF Operations Console.

For Cordova.

For Android.

For iOS.

Adding the Cordova plugin

In your Cordova application folder run:

cordova plugin add cordova-plugin-mfp-liveupdate

Adding the iOS SDK

  1. Edit your application’s podfile by adding the PersistentMobileFoundationLiveUpdate pod.
    For example:

    use_frameworks!
    
    target 'your-Xcode-project-target' do
       pod 'PersistentMobileFoundation'
       pod 'PersistentMobileFoundationLiveUpdate'
    end
    
  2. From a command-line window, nagivate to the Xcode project’s root folder and run the commmand: pod install.

Adding the Android SDK

To add the PMF SDK, first download the SDK .zip file from the PMF Operations Console → Download Center → SDKs tab. After completing the above steps, follow the below as well.

  • Extract the downloaded .zip file and place the relevant aar files to the app\libs folder.
  • Add the following to the dependencies closure:

      implementation fileTree(include: ['*.aar'], dir: 'libs')
    
  • Add the following to the repositories closure:
      repositories {
          flatDir {
              dirs 'libs'
          }
      }
    
      > If a Gradle Sync request appears, accept it.
    

Using the Live Update SDK

There are several approaches to using the Live Update SDK.

With the Live Update configuration retrieved, the applicative logic and the application flow can be based on the state of features and properties. For example, if today is a national holiday, introduce a new marketing promotion in the application.

Cordova Resolver

var input = { params : { 'paramKey': 'paramValue'} ,useClientCache : true };                                                                                                    
LiveUpdateManager.obtainConfiguration(input,function(configuration) {
        // do something with configration (JSON) object, for example:
        // console.log(configuration.properties.property-name);                                                                                                             // console.log(configuration.data.features.feature-name);                                                                                                        
    } ,
    function(err) {
        if (err) {
           alert('liveupdate error:'+err);
        }
  });

iOS

LiveUpdateManager.sharedInstance.obtainConfiguration(["paramKey":"paramValue"], completionHandler: { (configuration, error) in
  if error == nil {
    print (configuration?.getProperty("property-name"))
    print (configuration?.isFeatureEnabled("feature-name"))
  } else {
    print (error)
  }
})

Android

Map <String,String> params = new HashMap<>();
params.put("paramKey", "paramValue");

LiveUpdateManager.getInstance().obtainConfiguration(params , new ConfigurationListener() {

    @Override
    public void onSuccess(final Configuration configuration) {
        Log.i("LiveUpdateDemo", configuration.getProperty("property-name"));
        Log.i("LiveUpdateDemo", configuration.isFeatureEnabled("feature-name").toString());
    }

    @Override
    public void onFailure(WLFailResponse wlFailResponse) {
        Log.e("LiveUpdateDemo", wlFailResponse.getErrorMsg());
    }
});

Adapter implementation

The arguments that are provided by the application using the Live Update client SDK are then passed to the Live Update adapter. This is done automatically by the Live Update adapter without any developer action needed.

Advanced Topics

Import/Export

Once a schmea have been defined, the system administrator can export and import them to other server instances.

Export schema

curl --user admin:admin http://localhost:9080/mfpadmin/management-apis/2.0/runtimes/mfp/admin-plugins/liveUpdateAdapter/com.sample.HelloLiveUpdate/schema > schema.txt

Import schema

curl -X PUT -d @schema.txt --user admin:admin -H "Content-Type:application/json" http://localhost:9080/mfpadmin/management-apis/2.0/runtimes/mfp/admin-plugins/liveUpdateAdapter/com.sample.HelloLiveUpdate/schema
  • Replace “admin:admin” with your own (default is “admin”)
  • Replace “localhost” and the port number with your own if needed
  • Replace the application identifier “com.sample.HelloLiveUpdate” with your own application’s.

Caching

Caching is enabled by default in order to avoid network latency. This means that updates may not take place immediately.
Caching can be disabled if more frequent updates are required.

Cache expiration

The expirationPeriod value that is defined in Adapters → Live Update adapter dictates the length of time until the caching expires.

Image of the sample application

Sample application

In the sample application you select a country flag and using Live Update the app then outputs text in language that corresponds to the selected country. If enabling the map feature and providing the map, a map of the corresponding country will be displayed.

Click to download the Xcode project.
Click to download the Android Studio project.

Last modified on