For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


Add the optional MobileFirst components with Gradle

We can add more MobileFirst features to our Android application with Gradle.


Before you begin

Prerequisite: An existing Android Studio project with the app Gradle file set up to add the core MobileFirst SDK. See Setting up Android Studio projects with Gradle.


Overview

To add additional features, add the optional aar files to our Android Studio project. Some additional steps for setting up Android Studio to support your feature may exist.

These are the optional aar files:

Table 1. Android SDK
aar feature
ibmmobilefirstplatformfoundationpush.aar Push notifications. For more information on setup see Setting up push notifications.
ibmmobilefirstplatformfoundationjsonstore.aar JSONStore. For more information on setup see JSONStore.


Procedure

  1. For each aar to be added, add entries to the build.gradle file.
    1. For accessing and installing aar remotely, add a compile entry to the dependencies enclosure in the app\build.gradle file. There should be an existing compile entry for the main MobileFirst aar file.

      dependencies { compile 'com.ibm.mobile.foundation:ibmmobilefirstplatformfoundation:8.0.+' compile 'com.ibm.mobile.foundation:ibmmobilefirstplatformfoundationpush:8.0.+' compile 'com.ibm.mobile.foundation:ibmmobilefirstplatformfoundationjsonstore:8.0.+' }

      Note: In this example the latest version of 8.0 is imported. If we want to import a specific version such as 8.0.2016021411, replace with the MobileFirst version number you are using, including the major, minor, and patch numbers. The patch number is in the format YYYYMMDDHH. For example:

      compile 'com.ibm.mobile.foundation:ibmmobilefirstplatformfoundation:8.0.2016021411'

    2. For installing locally available aar files, copy the optional aar file to the libs folder. Add a line to the dependency enclosure for each aar file needed. This example adds all the optional and required SDKs.

      dependencies { compile(name:'ibmmobilefirstplatformfoundation', ext:'aar') compile(name:'ibmmobilefirstplatformfoundationjsonstore', ext:'aar') compile(name:'ibmmobilefirstplatformfoundationpush', ext:'aar') }

      Note: For information on obtaining the available optional aar files see Acquiring the MobileFirst SDK from the MobileFirst Operations Console.

  2. Rebuild your application.
  3. The imported SDK includes the Javadocs but they need to be linked in your Android Studio project. For details see Registering Javadocs to an Android Studio Gradle project.


Results

We can now start developing your native IBM MobileFirstâ„¢ Platform Foundation Android app with additional features.

Parent topic: Methods of setting up your environment