Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Changed android agent path

You will want to make changes to the Android Application Package (APK) that is in WSO2 IoT Server to suit your business or Organization requirements. For example, you will want to white label the WSO2 Android agent. In such situations, you need to do the required changes and create a new APK file. 

...

Excerpt
  1. Download and install Android Studio.

    Info

    For more information, see installing Android Studio.

  2. Replace the android.jar file that is in the <ANDROID_STUDIO>/<SDK location>/platforms/android-<CURRENT_API_LEVEL>
    directory with the android.jar file. You can get the new jar file using one of the following options:

    • Download the Android Open Source Project (AOSP) and build the source code to get the jar file for the required SDK level.

    • Use a pre-built jar file from a third party developer. You can find it here.

      Note

      Make sure to use the jar file that matches the compileSdkVersion of the WSO2 Android agent. Currently, the compileSdkVersion is 25.

    Info
    titleWhy is this needed?

    The WSO2 Android agent requires access to hidden APIs (APIs that are available at runtime). Therefore, you need to replace the anrdoid.jar file as mentioned in this step.

  3. WSO2 IoT Server supports API levels 17 to 25. Therefore, install the Android API levels 17 to 25 on Android Studio.
    1. Open Android Studio.
    2. Click SDK Manager.
    3. Click the SDK Platform tab and select the 17 and 25 API levels.
      Example:
    4. Click Apply.

...

  1. Clone the cdmf-agent-android GIT repository. This will be referred to as <ANDROID_AGENT_SOURCE_CODE>.

    Code Block
    https://github.com/wso2/cdmf-agent-android.git -b <ENTER_THE_VERSION>
    Info

    Check the WSO2 IoT Server and Agent Compatibility and find out what branch of this repo you need to clone.
    Example: WSO2 IoT Server 3.0.0 is compatible with the WSO2 Android agent 2.0.0. Therefore, the release tag will be release-2.0.0. 

  2. Open the client folder that is in the <ANDROID_AGENT_SOURCE_CODE> via Android Studio.
  3. Do the necessary changes you wish to make.
    Example: 
    White Labeling the WSO2 Android Agent or changing the Android agent SERVER_PROTOCOL to https and SERVER_PORT to 9443 in the constant.java file that is in the <ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/java/org/wso2/emm/agent/utils directory.
  4. The Android agent can't be built via the usual android developer SDK, as it requires access to developer restricted APIs. Therefore, you need to replace the existing android.jar file that is in the <SDK_LOCATION>/platforms/android-<COMPILE_SDK_VERSION> directory with the explicitly built android.jar file that has access to the restricted APIs. 
    You can get the new jar file using one of the following methods:

  5. Build the project to create a new APK file that has all the changes you made.

  6. Rename the created .apk file to  android-agent.apk.
  7. Copy the renamed file and replace it instead of the existing android-agent.apk file that is in the <IoT_HOME>/core/repository/deployment/server/jaggeryapps/android-web-agentdevicemgt/app/pages/mdmcdmf.unit.pagedevice.enrollmentstype.android.downloadtype-agentview/public/assetassets directory.