Unknown macro: {next_previous_link3}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 24 Current »

Prerequisites

  1. Download and install Android Studio.

    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.

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

    Why 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 from 17 to 25. Therefore, install the Android API levels from 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.

Creating a new APK

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

    Step 1 - git clone https://github.com/wso2/cdmf-agent-android.git
    Step 2 - git checkout tags/<server_compatible_tag_name>

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

    git checkout tags/v2.0.1
  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:  You can perform the following modifications to the client/client/build.gradle file: 
      • Update the value http ofthe buildConfigField “String”, SERVER_PROTOCOL”, “\http://\”” attributeto https if you wish to change the protocol to https. 
      • Update the value null ofthe buildConfigField “String”, DEFAULT_HOST”, “null” attribute to your hostname, e.g., https://10.10.10.192:8243 for https and http://10.10.10.192:8280 forhttp. 
  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 fileto  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-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset directory.

Before you begin

Download the Android agent source code. The folder will be referred to as <ANDROID_AGENT_SOURCE_CODE> throughout the documentation.


Changing Android Agent text and labels

  1. Locate the <ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/values/strings.xml file and update the following strings: 

    StringUsage
    app_nameThis appears as the WSO2 IoT Server device management agent name.
    wso2

    This appears on the WSO2 IoT Server activity kiosk when locked down.

    footer_textThis appears in the WSO2 IoT Server application footer.
    txt_message_titleThis appears in the notification message header.

    Example:

    <string name="app_name">WSO2 Device Management Agent</string>
    <string name="wso2">WSO2</string>
    <string name="footer_text">v%1$s ©%2$d WSO2</string>
    <string name="txt_message_title">WSO2 Device Management</string>

    Next, you can either build the new APK file or perform other changes.


Changing Android Agent colors

  1. Locate the <ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/values/colors/ file and update the following colors: 

    ColorUsage
    colorPrimaryThis is the WSO2 IoT Server application background color when in the lighter theme.
    colorPrimaryDarkThis is the WSO2 IoT Server application background color when in the darker theme.
    colorButtonThis is the button color prior to pressing.
    colorButtonPressedThis is the button color when pressed.
    colorButtonBorderThis is the button border color.
    topBannerTextThis is the top banner text color of the WSO2 IoT Server application.

    Example: 

    <color name="colorPrimary">#ef6c00</color>
    <color name="colorPrimaryDark">#bf360c</color>
    <color name="colorButton">#EF6C00</color>
    <color name="colorButtonPressed">#e78535</color>
    <color name="colorButtonBorder">#C77627</color>
    <color name="topBannerText">#ffffffff</color>

    Next, you can either build the new APK file or perform other changes.

Changing Android Agent logos and icons

  1. Navigate to the <ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/drawable-xxhdpi/ directory to update the following: 

    ImageResolutionUsage
    ic_launcher.png144px*144pxThis is the launcher icon.
    ic_logo_dark.png240px*72pxThis is the title bar image of the activity_authentication_error message. This image is ligher in shade.
    ic_logo.png240px*72pxThis is the title bar image of the activity_authentication_error message. This image is darker in shade.
    repeat_bg.png277px*125pxThis is the footer image of the activity_authentication_error message.
    splash_bg.png750px*123pxThis is the splash screen background image.
    wso2.png300px*125pxThis is the top banner logo.
    banner.png1023px*315pxThis is the top banner background.

    You can also remove ic_launcher.png, ic_logo_dark.png, ic_logo.png, and repeat_bg.png images in the following directories or replace them with appropriately resized images:

    • <ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/drawable-xxhdpi/
    • <ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/drawable-hdpi/
    • <ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/drawable-mdpi/
  2. Navigate to the <ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/drawable-land-xxhdpi/ directory to update the following: 

    ImageResolutionUsage
    splash_bg.png1232px*750pxThis is the splash screen background image.
    banner.png1920px*300pxThis is the top banner background.
  3. Change the permanent device lock screen logo.

    1. Navigate to the <ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/drawable-hdpi directory.

    2. Replace the ic_logo_dark.png file to change the icon.

  4. Open the client folder that is in the <ANDROID_AGENT_SOURCE_CODE>/client directory via Android Studio.
  5. 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.

  6. Restart the Android Studio. 

Building the APK 

  1. Build the project to create a new APK with the changes.

  2. Rename the created.apk file to android-agent.apk.
  3. Copy the renamed file and replace it instead of the existing android-agent.apk. file that is in the <IOTS_HOME>/repository/deployment/server/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset directory.
  • No labels