目录

Sample Code for Sending Downlink Messages Through HTTPS

This section describes only an example of a downlink message. For details about the parameters, please refer to Sending Downlink Messages.

{
    "validate_only": false,
    "message": {
        "notification": {
            "title": "test title",
            "body": "test body"
        },
        "android": {
            "collapse_key": -1,
            "urgency": "NORMAL",
            "category": "IM",
            "ttl": "86400s",
            "bi_tag": "testtag",
            "notification": {
                "image": "https://res.vmallres.com/pimages//common/config/logo/SXppnESYv4K11DBxDFc2.png",
                "icon": "/raw/ic_launcher2",
                "color": "#AACCDD",
                "sound": "/raw/shake",
                "default_sound": false,
                "importance": "NORMAL",
                "click_action": {
                    "type": 3
                },
                "body_loc_key": "demo_title_new2",
                "body_loc_args": [
                    "BODY_LOCAL_ARGS_A",
                    "BODY_LOCAL_ARGS_B",
                    "BODY_LOCAL_ARGS_C"
                ],
                "title_loc_key": "demo_title_new2",
                "title_loc_args": [
                    "TITLE_LOCAL_ARGS_A",
                    "TITLE_LOCAL_ARGS_B",
                    "TITLE_LOCAL_ARGS_C"
                ],
                "channel_id": "test_channel_id",
                "notify_summary": "Summary",
                "style": 1,
                "big_title": "the big title",
                "big_body": "the big body",
                "notify_id": 123456,
                "group": "mygroup",
                "badge": {
                    "add_num": 1,
                    "class": "com.huawei.demo.push.HuaweiPushApiExample"
                },
                "foreground_show": false,
                "ticker": "I am a ticker",
                "when": "2014-10-02T15:01:23.045123456Z",
                "use_default_vibrate": false,
                "use_default_light": false,
                "visibility": "PUBLIC",
                "vibrate_config": [
                    "1",
                    "3"
                ],
                "light_settings": {
                    "color": {
                        "alpha": 0,
                        "red": 0,
                        "green": 1,
                        "blue": 0.1
                    },
                    "light_on_duration": "3.5S",
                    "light_off_duration": "5S"
                }
            }
        },
        "token": [
            "token1"
        ]
    }
}