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 Server Key. Here you need to enter your Firebase Server Key that you received when creating a new Web App in Firebase.

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.

add android app

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

To learn more about how to create and modify JOLT templates please follow up in our developer documentation: push-templates