White Labeling the WSO2 Android Agent
Prerequisites
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
Changing Android Agent related logos and icons
Download the Android agent source code. The folder will be referred to as
<ANDROID_AGENT_SOURCE_CODE>
throughout the documentation.Navigate to the
<ANDROID_AGENT_SOURCE_CODE>/client/client/src/main/res
directory.- Navigate to the
drawable-xxhdpi/
folder and change the following:- Change the
ic_launcher.png
(144px X 144px
) file in order to change the icon. For more information, go to the Android icon guide.
- Change the
Change the following file logos in order to change the header logos:
ic_logo.png
(240px X 72px
)ic_logo_darker.png
(240px X 72px)
repeat_bg.png
(277px X 125px
)
- Navigate to the
drawable-xhdpi
folder.- Change the
ic_launcher.png
(96px X 96px
) file to change the icon. - Change the
ic_logo.png
(160px X 48px
),ic_logo_darker.png
(160px X 48px
) andrepeat_bg.png
(222px X 100px
) file in order to change the logos.
- Change the
- Navigate to the
drawable-hdpi
folder.- Change the
ic_launcher.png
(72px X 72px
) file in order to change the icon. - Change the
ic_logo.png
(120px X 36px
),ic_logo_darker.png
(120px X 36px
) andrepeat_bg.png
(122px X 55px
) files in order to change the logos.
- Change the
- Navigate to the
drawable-mdpi
folder.- Change the
ic_launcher.png
(48px X 48px
) file to change the icon. - Change the
ic_logo.png
(80px X 24px
) andic_logo_darker.png
(80px X 24px
) files in order to change the logos.
- Change the
- Navigate to the
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.
You can get the newjar
file using one of the following methods: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: https://github.com/anggrayudi/android-hidden-api.
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.<IoT_HOME>/core/repository/deployment/server/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset