Live Update service

improve this page | report issue

Overview

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

Note: For details on using Live Update with a traditional on-premise MobileFirst Server, refer to the documentation here.

Common Use Cases

Live Update supports defining and consuming configurations, making it easy to make customizations to the application. An example of a common use cases is:

  • Release trains and feature flipping

Following usecases will be supported in future releases.

  • A/B testing
  • Context-based customization of the application (e.g., geographic segmentation)

Jump to:

Concept

The Live Update service adds the following functions to every application.

  1. Features - Using features you can define configurable application features and set their default values.
  2. Properties - Using properties you can define configurable application properties and set their default values.

The developer or the application management team needs to decide upon the following.

  • The set of features and their default state where Live Update can be used.
  • The set of configurable string properties and their default values.

Once the parameters are decided upon, add the features and properties to the app through the Live Update section.

  • Feature: A feature determines if some part of the application functionality is enabled or disabled. When defining a feature 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 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.
    • defaultValue - The default value of the property that will be served unless it was overridden inside the segment (see Segment below). String, Editable.

Live Update Architecture

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

Architecture overview

  • Live Update service: an independent service which provides:
    • Application 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 MobileFirst Server.
  • MobileFirst Operations Console: used for configuring the Live Update adapter and settings.

Adding Live Update to MobileFirst Server

By default, Live Update service is bundled in the Mobile Foundation DevKit.

For OpenShift Container Platform (OCP) installation follow the documentation here.

Once the Live Update service is up, the Live Update Settings page is then shown for each registered application.

Configuring Application Security

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

  1. Load the MobileFirst Operations Console.
  2. Click [your application] → Security tab → Scope-Elements Mapping.
  3. Click New and enter the scope element liveupdate.mobileclient.
  4. Click Add.

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

Learn more about the MobileFirst security framework

Add a scope mapping

Define features and properties with values

See the following demonstration to define features and properties with values.

Add feature and property

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 MobileFirst Operations Console.

For Cordova, use SDK version 8.0.202003051505 or prior.

For Android, use SDK version 8.0.202003051505.

For iOS, use SDK version 8.0.202003051505 or prior version.

Adding the Cordova plugin

In your Cordova application folder run the following command.

cordova plugin add cordova-plugin-mfp-liveupdate

Adding the iOS SDK

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

    use_frameworks!
    
    target 'your-Xcode-project-target' do
       pod 'IBMMobileFirstPlatformFoundation'
       pod 'IBMMobileFirstPlatformFoundationLiveUpdate'
    end
    
  2. From a command-line window, navigate to the Xcode project’s root folder and run the following commmand.

      pod install
    

Adding the Android SDK

  1. In Android Studio, select Android → Gradle Scripts, then select the build.gradle (Module: app) file.
  2. Add ibmmobilefirstplatformfoundationliveupdate inside dependencies:

    dependencies {
         compile group: 'com.ibm.mobile.foundation',
         name: 'ibmmobilefirstplatformfoundation',
         version: '8.0.+',
         ext: 'aar',
         transitive: true
    
         compile group: 'com.ibm.mobile.foundation',
         name: 'ibmmobilefirstplatformfoundationliveupdate',
         version: '8.0.0',
         ext: 'aar',
         transitive: true
    }   
    

Using the Live Update SDK

There are several approaches to using the Live Update SDK.

Obtain Configuration

Implement logic to retrieve a configuration.
Replace property-name and feature-name with your own.

Cordova

    var input = { };
    LiveUpdateManager.obtainConfiguration({useClientCache :false },function(configuration) {
        // do something with configration (JSON) object, for example,
        // if you defined in the server a feature named 'feature-name':
        // if (configuration.features.feature-name) {
        //   console.log(configuration.properties.property-name);
	// }
    } ,
    function(err) {
        if (err) {
           alert('liveupdate error:'+err);
        }
  });

iOS

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

Android

LiveUpdateManager.getInstance().obtainConfiguration(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());
    }
});

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.

Advanced Topics

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.

Cordova

Controlling client side cache by using an optional useClientCache boolean flag:

var input = {useClientCache : false };
      LiveUpdateManager.getConfiguration(input,function(configuration) {
              // do something with resulting configuration, for example:
              // console.log(configuration.data.properties.property-name);  
              // console.log(configuration.data.features.feature-name);
      } ,
      function(err) {
              if (err) {
                 alert('liveupdate error:'+err);
              }
});

iOS

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

Android

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

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

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

Cache expiration

The expirationPeriod value is 30 minutes, which is the length of time until the caching expires.

Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.
Last modified on June 01, 2020