Android
Push.Delivery offers the possibility to send push notifications to Android devices over FCM.
For that, it is necessary to integrate the subscription API with your specific Android App. The the subscription API gives full flexibility for developers to handle the end user tag/topic subscriptions.
Setup Android in Admin UI
Please go into the "Apps" tab and add a new App.
Give your App a name, e.g. "My Android App".
Then select the platform "Android".
Upload an icon for the channel. This is only used inside the Push Admin so that you easier can recognize your created channels by image.
Also it is required to use a Push template. This template is used to define the information that will be send with the Android Push.
At the end you will be asked for a firebase settings. You can enter either Server Key or Service Account Key file. These are obtained from firebase account when creating a new App in Firebase.
When Service Account Key file is present, the firebase HTTP v1 API will be used. Server Key uses legacy API of firebase. When both are entered at same time in push console, by design system prefers service account key file when sending pushes. |
Legacy API of Firebase is already deprecated and will be discontinued by Google by June 2024. |
Please follow up this guide to learn how to get your credentials from Firebase.
After successfully creating the App for Android, the following information will be automatically shown inside the App:
-
ApiUser: This is the API username.
-
Password: This is the password for the API user.
-
AccessToken: Instead of using username and password an Access Token is created.
-
platformId: The platform ID.
-
AppId: The App ID.
After setting up the App, it is time to create Tags that users can register for.
Customize Payload
You can use this default template and modify it to your individual needs.
Default template:
[ { "operation": "shift", "spec": { "priority" : "priority", "ttl": "ttl", "title":"customFields.title", "message":"customFields.message", "url":"customFields.url", } }, { "operation": "default", "spec": { "pushScope": "token" } } ]
Default payload before transformation:
{ "title": "Default Title", "message": "This is the default message", "url": "/web-service/sample-link" }
Default payload after transformation:
{ "customFields" : { "title" : "Default Title", "message" : "This is the default message", "url" : "/web-service/sample-link" }, "pushScope" : "token" }
Message Object:
Parameter |
Type |
Description |
Required |
Defaults |
Comments |
pushScope |
String |
'token' or 'topic' |
Optional |
token |
FCM topic or push directly to registered tokens |
hasMessageTypeNotification |
Boolean |
true or false |
Optional |
false |
enable notification message type |
hasMessageTypeData |
Boolean |
true or false |
Optional |
true |
enable data message type |
timeToLive |
Integer |
time to live (in seconds) |
Optional |
3600 |
FCM message lifespan |
collapseKey |
String |
collapse key |
Optional |
- |
FCM setting collapse key |
priority |
String |
high or normal |
Optional |
normal |
FCM message priority |
title |
String |
title of notification message type |
Optional |
- |
title field from FCM namespace |
body |
String |
body of notification message type |
Optional |
- |
body field from FCM namespace |
image |
String |
image of notification message type |
Optional |
- |
image field from FCM namespace |
customFields |
Map |
Specify custom payload values outside the firebase reserve namespace. Arbitrary key/value payload with string data type |
Optional |
- |
Custom values |
both timeToLive and priority convey a sense of urgency to Firebase. The exact handling of these values cannot be documented in detail here, and is subject to be changed from time to time by Google. However, consistent use of high priority values may result in permanent penalty to delivery times. |
To learn more about how to create and modify JOLT templates please follow up in our developer documentation: push-templates |