Android

User identifiers

In order to find a user to whom you need to send a notification, it is possible to specify one or several available identifiers:

Notification settings

The object of a message for the Android platform contains 2 fields:

  • payload (object) - describes the main content of a notification

  • options (object) - describes the optional settings of notification delivery

Notification content settings ("payload” object)

Notification delivery and display settings ("options" object)

Examples

Visible push notification

​https://devtodev.com/api/v1/push/send

POST

{
    "user_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "app_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "campaign_tag": "campaign name",
    "pack_id": "uniqueid1234",
    "audience": [{
        "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "advertisingId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "androidId": "xxxxxxxxxxxxxxxxxxxxxxxxx",
        "userId": "xxxxxxxxxxxx"
    }],
    "android": {
        "payload": {
            "title": "Title of the notification",
            "text": "Notification content.",
            "data": {
                "key1": "value",
                "key2": "15"
            },
            "small_icon": "smallicon",
            "icon": "midicon",
            "image": "https://domain.com/pic.png",
            "sound": "bingbong",
            "vibration": true,
            "led_color": "#ff0000",
            "color": "#ff0000",
            "action": {
                "url": "http://www.domain.com"
            },
            "interactive": {
                "buttons": [{
                    "id": "accept",
                    "text": "Accept",
                    "handling": "foreground",
                    "action": {
                        "url": "http://www.domain.com/accept"
                    }
                }, {
                    "id": "decline",
                    "text": "Decline",
                    "handling": "background"
                }]
            }
        },
        "options": {
            "hidden": false,
            "priority": "normal",
            "expire": 36000,
            "collapse_key": "collapse1"
        }
    }
}

Hidden push notification

​https://devtodev.com/api/v1/push/send

POST

{
    "user_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "app_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "campaign_tag": "campaign name",
    "pack_id": "uniqueid1234",
    "audience": [{
        "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "advertisingId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "androidId": "xxxxxxxxxxxxxxxxxxxxxxxxx",
        "userId": "xxxxxxxxxxxx"
    }],
    "android": {
        "payload": {
            "data": {
                "key1": "value",
                "key2": "15"
            }
        },
        "options": {
            "hidden": true,
            "priority": "normal",
            "expire": 36000
        }
    }
}

Last updated