White Labeling the WSO2 Android Agent
Download and install Android Studio. For more information, see installing Android Studio. Replace the Download the Android Open Source Project (AOSP) and build the source code to get the 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 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 Clone the cdmf-agent-android GIT repository. This will be referred to as Check the WSO2 IoT Server and Agent Compatibility and find out what tag of this repo you need to checkout. 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 Download the Android Open Source Project (AOSP) and build the source code to get the Build the project to create a new APK file that has all the changes you made.Prerequisites
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:jar
file for the required SDK level.compileSdkVersion
of the WSO2 Android agent. Currently, the compileSdkVersion
is 25.anrdoid.jar
file as mentioned in this step.
Example: Creating a new APK
<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>
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
<ANDROID_AGENT_SOURCE_CODE>
via Android Studio.
Example: You can perform the following modifications to the client/client/build.gradle
file: http
ofthe buildConfigField “String”, SERVER_PROTOCOL”, “\http://\””
attributeto https
if you wish to change the protocol to https. 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. 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:jar
file for the required SDK level..apk
fileto android-agent.apk
.android-agent.apk
file that is in the <
directory.IoT_HOME>/core/repository/deployment/server/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset
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
Locate the
<ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/values/strings.xml
file and update the following strings:String Usage app_name
This appears as the WSO2 IoT Server device management agent name. wso2
This appears on the WSO2 IoT Server activity kiosk when locked down.
footer_text
This appears in the WSO2 IoT Server application footer. txt_message_title
This 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
Locate the
<ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/values/colors/
file and update the following colors:Color Usage colorPrimary This is the WSO2 IoT Server application background color when in the lighter theme. colorPrimaryDark This is the WSO2 IoT Server application background color when in the darker theme. colorButton This is the button color prior to pressing. colorButtonPressed This is the button color when pressed. colorButtonBorder This is the button border color. topBannerText This 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
Navigate to the
<ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/drawable-xxhdpi/
directory to update the following:Image Resolution Usage ic_launcher.png
144px*144px This is the launcher icon. ic_logo_dark.png
240px*72px This is the title bar image of the activity_authentication_error
message. This image is ligher in shade.ic_logo.png
240px*72px This is the title bar image of the activity_authentication_error
message. This image is darker in shade.repeat_bg.png
277px*125px This is the footer image of the activity_authentication_error
message.splash_bg.png
750px*123px This is the splash screen background image. wso2.png
300px*125px This is the top banner logo. banner.png
1023px*315px This is the top banner background. You can also remove
ic_launcher.png
,ic_logo_dark.png
,ic_logo.png
, andrepeat_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/
Navigate to the
<ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/drawable-land-xxhdpi/
directory to update the following:Image Resolution Usage splash_bg.png
1232px*750px This is the splash screen background image. banner.png
1920px*300px This is the top banner background. Change the permanent device lock screen logo.
Navigate to the
<ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res/drawable-hdpi
directory.Replace the
ic_logo_dark.png
file to change the icon.
- Open the client folder that is in the
<ANDROID_AGENT_SOURCE_CODE>/client
directory via Android Studio. 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.Restart the Android Studio.
Building the APK File
Build the project to create a new APK with the changes.
- Rename the created
.apk
file toandroid-agent.apk
. - Copy the renamed file and replace it instead of the existing
android-agent.apk
. file that is in the
directory.<IOTS_HOME>/repository/deployment/server/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset