Follow the instructions given below to configure WSO2 IoT Server Firebase Cloud Messaging (FCM):
cdmf-agent-androidGIT repository. This is be referred to as
<ANDROID_AGENT_SOURCE_CODE>throughout this document.
Make sure that the Android agent release version matches the IoT Server release version. Click here for more information.
- Download and install Android Studio. For more information, see installing Android Studio.
- Go to the Firebase API Console.
- Click CREATE NEW PROJECT.
Provide a preferred name for the project (example: WSO2-FCM), select the country/region, and click CREATE PROJECT.
The new project is created in few seconds, and you are navigated to the overview page of the project.
Click Add Firebase to your Android App on the overview page of the project.
Provide the package name of the WSO2 Android agent, that is
org.wso2.iot.agentand click REGISTER APP.
Click Download google-service.json to download the configurations.
- Replace the
<ANDROID_AGENT_SOURCE_CODE>/client/client/google-services.jsonfile with the
google-services.jsonfile you just downloaded.
- Click CONTINUE > FINISH to finish the process and create the application.
You are navigated to the overview of the created application.
<ANDROID_AGENT_SOURCE_CODE>via Android Studio, clean the project, and build the project.
The WSO2 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.jarfile that is in the
<SDK_LOCATION>/platforms/android-<COMPILE_SDK_VERSION>directory with the explicitly built
android.jarfile that has access to the restricted APIs.
For more information on how to build the project, see creating a new APK file.
- Rename the created
- Copy the renamed file and replace the existing
android-agent.apkfile that is in the
- Open the
<IoT_HOME>/repository/deployment/server/devicetypes/android.xmlfile and uncomment the configuration given below to enable communication via FCM.
isScheduledelement used to enable the scheduler task that sends push notifications. The task sends the push notifications in batches. So this reduces the sudden request burst when many devices try to access the server after receiving the push notification.
- Restart the WSO2 IoT Server in order to apply the changes.