Download the sample app project
Download the sample A3L messaging app to get started. The file contains an Android project which you can use to configure and build the sample app. When building the project, if you run into an “SDK location not found” error, add a line in the local.properties file at the root of the project to include your Android SDK location. For example:- On Windows, add the line:
sdk.dir=C:\\Users\\<username>\\AppData\\Local\\Android\\sdk - On Mac, add the line:
sdk.dir=/Users/<username>/Library/Android/sdk
<username> with your username.
Sample app integration
The sample app requires both device-side credentials as well as server-side credentials. Device-side credentials are present in the app and are required for cloud messaging to work. Typically, server-side credentials should be used in a secure server environment. However, for demonstration, this app uses server-side credentials in the app itself. In a real project, don’t use server-side credentials in the app, as this wouldn’t be secure. There are four configuration files which you must populate for the sample app to run.| File name | Location | Configuration type | Messaging type |
|---|---|---|---|
| api_key.txt To obtain, see step 1 in Device-side configuration. | app/src/main/assets/ | Device-side | ADM |
| adm_server_configuration.json To obtain, see step 1 in Server-side configuration. | app/src/main/assets/ | Server-side | ADM |
| google-services.json To obtain, see step 2 in Device-side configuration. | app/ | Device-side | FCM |
| fcm_server_configuration.json To obtain, see 2 in Server-side configuration. | app/src/main/assets/ | Server-side | FCM |
Device-side configuration
First, obtain device-side configurations for both Amazon Device Messaging (ADM) and Firebase Cloud Messaging (FCM). While generating credentials, you might need to provide the package name of your app. The sample app’s package name iscom.example.SampleA3LMessagingApp.
- For ADM, go to the Developer Console and obtain your credentials. Then add an API key to your project. Be sure to enable device messaging for your app by attaching the security profile under the App Services section of your app in the Developer Console.
- For FCM, create a Firebase project and register your app with Firebase. Obtain a google-services.json configuration file and add the file to your project.
Server-side configuration
Next, obtain server-side configurations for ADM and FCM.-
For ADM, add the client ID and client secret to the adm_server_configuration.json, which is present under the assets folder. An example ADM server configuration JSON follows.
-
For FCM, create a Google service account key and follow the instructions to download the key as a JSON file. You can also use an existing service account key. Copy the content of the downloaded JSON and paste it into fcm_server_configuration.json, located under the assets folder. An example FCM server configuration JSON follows.
Sample app testing
- After configuring all four configuration files, build the app.
- Install the app on an Android device that has the Google Play Service enabled or on a Fire OS device.
- Open the app. You should see a welcome page with debug placeholder text and a SEND PUSH NOTIFICATION button.
- Click SEND PUSH NOTIFICATION. A toast message instructing you to check the notification tray should appear. You should also see a debug statement containing the device ID where the placeholder text was previously.
-
Check the notification tray of the device to make sure the message was successfully delivered.

A successfully delivered notification

