English
Requires HBuilderX 3.5.1 and above to support
options More parameter configuration
Since the specific push parameters supported by different mobile phone manufacturers are not uniform, uniPush provides a consistent push API in order to reduce the access cost of developers.
The following two requirements can be implemented by passing in parameters in the options
parameter.
If the developer wants to achieve different effects on the mobile terminal of different manufacturers;
Example: You want to implement two mobile phones, iOS and Huawei. After receiving the message, the changes of the angle labels are: -1 and +1 on the original value. effect
An example of options configuration is as follows:
"options": {
"IOS":{
"auto_badge":"-1",
},
"HW": {
"/message/android/notification/badge/class": "io.dcloud.PandoraEntry",
"/message/android/notification/badge/add_num": 1
}
}
For some uncommon functions supported by specific manufacturers, uniPush does not provide unified encapsulation.
For example, implement the [Xiaomi] channel to filter the app version number
An example of options configuration is as follows:
"options": {
其他配置...,
"XM": {
"/extra.app_version": "v3.3.0"
}
}
"options": {
"HW": {
"/message/android/notification/badge/class": "io.dcloud.PandoraEntry",
"/message/android/notification/badge/add_num": 1,
"/message/android/notification/badge/set_num": 2
}
}
name | type | required | default value | description |
---|---|---|---|---|
/message/android/notification/badge/class | String | Yes | None | value: io.dcloud.PandoraEntry |
/message/android/notification/badge/add_num | Integer | Yes | None | value: The number is accumulated by the application index, not the actual number displayed by the application index must be an integer greater than 0 and less than 100 |
/message/android/notification/badge/set_num | Integer | Yes | No | value: The number of the subscript setting must be an integer greater than 0 and less than 100. If set_num and add_num exist at the same time, set_num shall prevail |
Note
1. Clicking the startup icon or the notification bar system will not clear the number of corner labels. It needs to be applied on the terminal side to clear the corner labels through the corner label API;
2. add_num: EMUI version 8.0.0 (and above), push service App version 8.0.0 (and above) support;
3. set_num: EMUI version 10.0.0 (and above), push service App version 10.1.0 (and above) support.
"options": {
"HW": {
"/message/android/notification/image": "公网可以访问的https图标链接",
"/message/android/notification/style": 1,
"/message/android/notification/big_title": "big_title",
"/message/android/notification/big_body": "big_body"
}
}
Precautions
1. Notification long text: EMUI version 9.1.0 (and above), push service App version 9.1.1 (and above) support.
Before using message classification, you need to send an email to Huawei to apply for permission. See Huawei Message Classification Application
key description
name | type | required | default value | description |
---|---|---|---|---|
/message/android/notification/importance | String | No | None | When the value is "LOW", it indicates that the message is information marketing; when the value is "NORMAL", it indicates that the message is service and communication |
Options parameter description:
Example of setting under Options parameter [ups parameter]:
"HW": {
"/message/android/notification/importance","LOW"
}
Offline custom ringtone settings require the use of an Android client
key description
name | type | required | default value | description |
---|---|---|---|---|
/message/android/notification/default_sound | Boolean | yes | no | set to false, use sound to customize ringtone |
/message/android/notification/channel_id | String | Yes | None | Since the Android O version, it can support the notification bar custom channel, specify which notification channel the message should be displayed on. For details, please refer to [Custom Notification Channel](https 😕/developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides-V5/android-custom-chan-0000001050040122-V5). Custom notification channels are only valid for critical-level messages sent to user devices. General-level messages are still displayed through Huawei's marketing notification channels. |
/message/android/notification/sound | String | Yes | No | Custom message notification ringtone, valid when a new channel is created, the ringtone file set here must be stored in the /res/raw path of the application, for example, set as "/raw/shake" corresponds to the local "/res/raw/shake.xxx" file of the application. The supported file formats include MP3, WAV, MPEG, etc. If not set, use the default system ringtone. |
/message/android/notification/importance | String | No | None | When the value is "LOW", it indicates that the message is information marketing; when the value is "NORMAL", it indicates that the message is service and communication |
Note: Custom ringtones are affected by Huawei's own notification message weight
Custom notification channels are only valid for service and communication-level messages sent to user devices. General-level messages are still displayed through Huawei's marketing notification channels (general-level messages do not play custom ringtones). This time the custom ringtone will not play. The message category is controlled by Huawei's AI intelligent judgment, or developers can apply to Huawei for [Self-Classification Rights Application](https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides-V5/message -frequency-restriction-0000001149358835-V5#EN-CN_TOPIC_0000001149358835__section893184112272)
Rest-v2 example:
Example of setting under Options parameter [ups parameter]:
"HW": {
"/message/android/notification/default_sound",false,
"/message/android/notification/channel_id","RingRing4",
"/message/android/notification/sound","/raw/ring001"
}
The message channels of Xiaomi Push are divided into two categories: "Normal Message" (default) and "Important Message", and common messages are delivered by default. The number of ordinary messages that can be pushed in a single day is limited, and there is no limit to important messages. For details on important news applications, please refer to: New Rules for Classification of Xiaomi Push News
"options": {
"XM": {
"/extra.channel_id": "Default"
}
}
name | type | required | default value | description |
---|---|---|---|---|
/extra.channel_id | String | Yes | None | value: fill in the channel id applied for on the Xiaomi platform |
Notes:
1. If you use important messages, you need to create a corresponding channel on the client side. For details, please refer to: [MIUI 10 Notification Category (Channel) Adaptation Instructions](https://docs.getui.com/getui/server/rest_v2/third_party /)
First call the Xiaomi interface, upload the picture, and get the picture url.
Java method reference (Xiaomi official documentation) 4.4.1 Large image/large text/Large icon , or integrate a push tool set from multiple vendors .
RestAPI method reference (Xiaomi official documentation) 11.1 Big Picture, Big Text/Upload Big Picture API .
"options": {
"XM": {
"/extra.notification_style_type": 2,
"/extra.notification_bigPic_uri":"http://url.big.pic/xxx.png"
}
}
name | type | required | default value | description |
---|---|---|---|---|
/extra.notification_style_type | String | Yes | No | 1 means multi-character version; 2 means that when 1 is filled in the large version, the text content is the value in the body |
/extra.notification_bigPic_uri | String | Yes | None | /extra.notification_style_type If 2 is filled, fill in, indicating the address of the big picture (uploaded to the url returned by Xiaomi) Image requirements: Fixed 876x324px, less than 1M, PNG/JPG/JPEG format. |
/extra.notification_large_icon_uri | String | Yes | None | Notification thumbnail; value: Fill in the image link returned by the interface. The Large icon can appear in large-picture and multi-text messages, displayed on the right, and notification thumbnails. Image requirements: The size must be 120×120px, the file size must be less than 200KB, in PNG/JPG/JPEG format. |
Notes:
1. Rich text messages are only supported in MIUI10 and above. On lower versions and non-MIUI systems, the messages will be displayed in the style of ordinary messages;
2. In the domestic version of MIUI system, the large icon is only supported in MIUI12 and above, and will not be displayed in versions below MIUI12;
3. When sending a large image message, if the image download fails due to network reasons, the image will not be displayed, but will be displayed in the normal message style.
Offline custom ringtone settings require the use of an Android client
key description
name | type | required | default value | description |
---|---|---|---|---|
/extra.sound_uri | String | Yes | No | Custom sound_url address applied by Xiaomi backend, example: android.resource://your packagename/raw/XXX |
/extra.channel_id | String | Yes | No | Notification category id applied by Xiaomi background |
Note: If the server /extra.sound_uri and /extra.channel_id are set at the same time, the notification effect of Android 8.0 and above is subject to the effect in the channel
1、 Client-Xiaomi manufacturer version needs to use com.getui:xmp:1.0.8 version or Xiaomi-3.0.1 version or above
2、 The client ringtone file is placed in the raw directory of the Android app;
3、 For Xiaomi models above android8, offline custom ringtones only work in the channel channel. If you need multiple different ringtones, you need multiple different channel channels
Therefore, it is necessary to create a new channel channel on the Xiaomi platform, and set the custom ringtone front-end path such as: android.resource://your packagename/raw/test (the path does not need to have an audio suffix name) as shown in the figure
Rest-v2 example:
Example of setting under Options parameter [ups parameter]:
"XM": {
"/extra.sound_uri": "小米后台申请的自定义 sound_url 地址",
"/extra.channel_id": "小米后台申请的通知类别id"
}
"options": {
"XM": {
"/extra.locale": "zh_CN"
}
}
key description
name | type | required | default value | description |
---|---|---|---|---|
/extra.locale | String | No | None | The language ranges of devices that can receive messages, separated by commas. For example, mainland China is represented by zh_CN. |
/extra.locale_not_in | String | No | None | The language ranges of devices that cannot receive messages, comma-separated. |
"options": {
"XM": {
"/extra.model": "MI 4LTE"
}
}
key description
name | type | required | default value | description |
---|---|---|---|---|
/extra.model | String | No | None | The range of models of devices that can receive messages, separated by commas. How to get the model of the current device: Build.MODEL. For example, Xiaomi Mi Phone 4 mobile version is represented by "MI 4LTE". |
/extra.model_not_in | String | No | None | The model range of devices that cannot receive messages, separated by commas. |
"options": {
"XM": {
"/extra.app_version": "v3.3.0"
}
}
key description
name | type | required | default value | description |
---|---|---|---|---|
/extra.app_version | String | No | None | App version numbers that can receive messages, separated by commas. The Android app version number is derived from the value of "android:versionName" in the manifest file. |
/extra.app_version_not_in | String | No | None | The version number of the app that cannot receive messages, separated by commas. |
"options": {
"XM": {
"/extra.notification_style_button_left_name": "左侧按钮",
"/extra.notification_style_button_left_notify_effect": "3",
"/extra.notification_style_button_left_web_uri": "https://c.runoob.com/front-end/854/"
}
}
key description
name | type | required | default value | description |
---|---|---|---|---|
/extra.notification_style_button_left_notify_effect | String | No | None | The action after the left button is clicked. The following values are supported: 1: Open the app 2: Open the specified page in the app 3: The button will not be displayed if the web page is not configured or configured with other values. |
/extra.notification_style_button_left_name | String | No | None | Left button name. This parameter must be configured, otherwise the button will not be displayed. . |
/extra.notification_style_button_left_intent_uri | String | No | None | Open the app. |
/extra.notification_style_button_left_web_uri | String | No | None | Click the left button to open the specified web page. |
/extra.notification_style_button_left_intent_class | String | No | None | Click the left button to open the specified page in the app. |
/extra.notification_style_button_right_notify_effect | String | No | None | The action after the right button is clicked. The following values are supported: 1: Open the app 2: Open the specified page in the app 3: The button will not be displayed if the web page is not configured or configured with other values. |
/extra.notification_style_button_right_name | String | no | none | right button name. This parameter must be configured, otherwise the button will not be displayed. . |
/extra.notification_style_button_right_intent_uri | String | No | None | Open the app. |
/extra.notification_style_button_right_web_uri | String | No | None | Click the button on the right to open the specified web page. |
/extra.notification_style_button_right_intent_class | String | No | None | Click the button on the right to open the specified page in the app. |
/extra.notification_style_button_mid_notify_effect | String | No | None | The action after the middle button is clicked. The following values are supported: 1: Open the app 2: Open the specified page in the app 3: The button will not be displayed if the web page is not configured or configured with other values. |
/extra.notification_style_button_mid_name | String | No | None | Middle button name. This parameter must be configured, otherwise the button will not be displayed. . |
/extra.notification_style_button_mid_intent_uri | String | No | None | Open the app. |
/extra.notification_style_button_mid_web_uri | String | No | None | Click the middle button to open the specified web page. |
/extra.notification_style_button_mid_intent_class | String | No | None | Click the middle button to open the specified page in the app. |
All channels on the OPush platform are divided into two categories: "public letter" (default) and "private letter", and public letter messages are sent by default. There is a limit to the number of public messages that can be pushed in a single day, and unlimited private messages (only for a single user). For private message application, please refer to (OPPO official document) Channel Upgrade Public Beta Invitation .
"options": {
"OP": {
"/channel_id": "Default"
}
}
name | type | required | default value | description |
---|---|---|---|---|
/channel_id | String | Yes | None | value: fill in the channel ID registered on the OPPO platform |
Precautions
1. This interface can be used only after contacting a personal push technician to apply for activation;
2. OPPO private message only supports single push.
3. If you use private messages, you need to create a corresponding private message channel on the client side. For details, please refer to: Notification Channel (Channel) Adaptation
First call the OPPO interface, upload a picture, and get the icon url.
Java method integrates a push multi-vendor push tool set .
RestAPI reference "Image upload" .
"options": {
"OP": {
"/small_picture_id": "xxxxxxxxxxxxxxx",
// "style": 2,
"/style": 3,
"/big_picture_id": "big_body"
}
}
Name | Type | Required | Default | Single Push Support | Description |
---|---|---|---|---|---|
/style | Integer | Yes | None | Yes | Notification bar style 1. Standard style 2. Long text style (available for ColorOS version > 5.0, the first message in the notification bar can display the entire content, and the non-first message only displays one line of content) 3. Large image style (ColorOS version > 5.0 is available, the first message in the notification bar displays the large image, the non-first message does not display the large image, and the push method only supports broadcast) |
/small_picture_id | String | Yes | No | No | Notify small picture; value: fill in the icon ID returned by the interface Image requirements: The size is 144*144 px, the file size is within 50k, and the format is PNG/JPG/JPEG. |
/big_picture_id | String | Yes | No | No | Notify Big Picture value: fill in the icon id returned by the interface, required when style is 3 Image requirements: Size 876*324px, file size within 1M, and the format is PNG/JPG/JPEG. |
Notes:
Notification small icons and large images do not support single push, and a single push request will return a permissionless error
The app developer customizes the message ID, and the OPPO push platform performs deduplication processing based on this ID.
"options": {
"OP": {
"/app_message_id": "xxxx"
}
}
Name | Type | Required | Default | Single Push Support | Description |
---|---|---|---|---|---|
/app_message_id | String | Yes | None | Yes | The app developer customizes the message ID, and the OPPO push platform performs deduplication processing based on this ID. The same app_message_id for tolist push and all user pushes will only be saved once, and the same app_message_id for single push Only push once |
Developers can set timed display according to their own business needs. After the timed display function is successfully set, the message will be delivered immediately, and it will not be displayed directly after reaching the user's mobile phone. The message will be displayed within the set timed display time.
"options":{
"OP":{
"/show_time_type":1,
"/show_start_time":1640570400000,
"/show_end_time":1640571000000
}
}
Name | Type | Required | Default | Single Push Support | Description |
---|---|---|---|---|---|
/show_time_type | Int | No | 0 | No | show type (0, "real time"), (1, "timed") |
/show_start_time | Long | No | 0 | No | Timing show start time (converted to local time according to time_zone), time in milliseconds |
/show_end_time | Long | No | 0 | No | The end time of the scheduled display (converted to local time according to time_zone), the time in milliseconds |
Note: The message is not displayed when it reaches the start time, it is displayed between the start time and the end
Developers can set the validity period of each message. Within the set validity period, as long as the device is connected to the Internet, the message will be received. The message is valid for a maximum of 10 days and a minimum of 1 hour.
"options":{
"OP":{
"/off_line":true,
"/off_line_ttl":86400
}
}
Name | Type | Required | Default Value | Description | Support Single Push |
---|---|---|---|---|---|
/off_line | Boolean | No | TRUE | ||
/off_line_ttl | Int | No | 3600 | Offline message survival time (time_to_live) (unit: second), [up to 10 days] | Yes |
The message starts timing after the notification bar is displayed, and automatically disappears from the notification bar after reaching the corresponding time filled in
"options":{
"OP":{
"/show_ttl":86400
}
}
Name | Type | Required | Default | Single Push Support | Description |
---|---|---|---|---|---|
/show_ttl | int | No | 86400 | Yes | Time-limited display (unit: seconds), the message starts timing after the message is displayed in the notification bar, and automatically disappears from the notification bar when the corresponding time is reached. The default is 1 day. Time range 6 * 60 * 60 s -- 48 * 60 * 60 s |
Passed to the app or web page when the in-app page or web page is opened
"options":{
"OP":{
"/action_parameters/key":"value",
"/action_parameters/key1":"value1"
}
}
Name | Type | Required | Default | Single Push Support | Description |
---|---|---|---|---|---|
/action_parameters/XXX | String | No | null | Yes | XXX represents custom parameters, action parameters, which are passed to the app or web page when the in-app page or web page is opened |
The vivo message classification function divides push message types into operational messages and system messages, and operational messages are delivered by default. The maximum number of operational messages received by a single user and a single application in a single day is 5, and there is no limit to system messages. The system message function does not need to be applied for, and can be used directly. If you need to increase the system message level in special circumstances, please refer to the description of the push message classification function (vivo official documentation) .
"options": {
"VV": {
"/classification": 0
}
}
name | type | required | default value | description |
---|---|---|---|---|
/classification | Integer | no | 0 | value: 0 for operational messages, 1 for system messages |
Notification message type, ringtone and vibration settings, only valid for Android 8.0 and below systems
"options": {
"VV": {
"/notifyType": 0
}
}
name | type | required | default value | description |
---|---|---|---|---|
/notifyType | int | Yes | None | Notification Type 1: None, 2: Ring, 3: Vibrate, 4: Ring and Vibrate Note: Only valid for Android 8.0 and below |
The developer can set the network mode for the mobile phone to receive messages. If the mobile phone is set to send under wifi, the message can only be received if the mobile phone's networking mode is wifi; the settings are not limited, and the mobile phone can receive messages as long as it is connected to the Internet
"options": {
"VV": {
"/networkType": -1
}
}
name | type | required | default value | description |
---|---|---|---|---|
/networkType | int | no | -1 | network type -1: unlimited, 1: send under wifi |
The developer can set the retention time of each message. Within the set retention time, as long as the device is connected to the Internet, the message will be received.
"options":{
"VV":{
"/timeToLive":86400
}
}
name | type | required | default value | description |
---|---|---|---|---|
/timeToLive | int | No | 86400 | Message retention time Unit: second, the value is at least 60 seconds for single push, at least 900 seconds for group push, and up to 7 days. When the value is empty, the default is one day |
Client-defined key-value pair, the app can obtain the key-value pair according to the client SDK access documentation
"options":{
"VV":{
"/clientCustomMap/key":"value",
"/clientCustomMap/key1":"value1"
}
}
name | type | required | default value | description |
---|---|---|---|---|
/clientCustomMap/XXX | String | No | null | Custom key-value pair on the client side, the app can obtain the key-value pair according to the client SDK access document |
For specific parameter meanings, please refer to Apple APNs documentation
name | type | required | default value | description |
---|---|---|---|---|
type | String | No | notify default notification message | voip: voip voice push, notify: apns notification message |
aps | Json | No | None | Push Notification Message Content |
auto_badge | String | No | None | It is used to calculate the number displayed on the icon, and it can also realize the automatic increase or decrease of the displayed number, such as "+1", "-1", "1", etc. The calculation result will cover the badge |
payload | String | No | None | Add custom data |
multimedia | Json Array | No | None | Multimedia Settings |
apns-collapse-id | String | No | None | A previous message can be overwritten with the same apns-collapse-id |
aps
name | type | required | default value | description |
---|---|---|---|---|
alert | Json | No | None | Notification Message |
content-available | Number | No | 0 | 0 means normal notification message (default is 0); 1 means silent push (no notification bar message), no other parameters need to be filled in silent push. Apple recommends pushing up to 3 silent messages per hour |
sound | String | No | None | Notification ringtone file name, if the ringtone file is not found, the ringtone is the system default ringtone. Set silent to "com.gexin.ios.silence" or leave it blank |
category | String | No | None | Trigger specific actions and button display in the client notification bar |
thread-id | String | No | None | The remote notification of ios groups notifications by this property, only supports iOS 12.0 and above |
alert
name | type | required | default value | description | |
---|---|---|---|---|---|
title | String | No | None | Notification message title | |
body | String | No | None | Notification Message Content | |
action-loc-key | String | No | None | (for multi-language support) Specifies the Localizable.strings used by the execute button | |
loc-key | String | no | none | (for multi-language support) specifies the corresponding key | in the Localizable.strings file |
loc-args | String Array | No | None | If placeholders are used in loc-key, specify each parameter in loc-args | |
launch-image | String | No | None | Specify the image name of the launch interface | |
title-loc-key | String | No | None | (for multi-language support) For the Localizable.strings used by the title-specific execution button, only iOS8.2 and later versions are supported | |
title-loc-args | String Array | No | None | For the title, if placeholders are used in loc-key, specify each parameter in loc-args, only supports iOS8.2 and above | |
subtitle | String | No | None | Notification subtitle, only supports iOS8.2 and above | |
subtitle-loc-key | String | No | None | The keyword of the subtitle string in the current localization file, only supports iOS8.2 and above | |
subtitle-loc-args | String Array | No | None | Variable parameters that need to be replaced in the current localized subtitle content, only supports iOS8.2 and above |
multimedia description:
This field is of type Array, and up to 3 sub-items can be set. Each parameter is defined as follows:
name | type | required | default value | description |
---|---|---|---|---|
url | String | Yes | None | Multimedia resource URL |
type | Number | Yes | None | Resource Type (1.Image, 2.Audio, 3.Video) |
only_wifi | Boolean | No | false | Whether to load only in wifi environment, if set to true, but when wifi is not used, it will be displayed as a normal notification |
Example:
voip voice push:
{
"ios":{
"type":"voip",
"payload":"自定义消息"
}
}
apns notification message
{
"IOS":{
"type":"notify",
"payload":"自定义消息",
"aps":{
"alert":{
"title":"通知标题",
"body":"通知内容"
},
"content-available":0,
"sound":"com.gexin.ios.silence",
"category":"ACTIONABLE"
},
"auto_badge":"+1",
"multimedia": [{
"url": "https://xxx",
"type": 1,
"only_wifi": false
}]
}
}
For apn silent push, please refer to Apple APNs documentation
{
"ios":{
"aps":{
"content-available":1
},
"payload": "自定义消息"
}
}
Notification display style, text + long text style and text + large image style, choose one of the two; This parameter applies to all models under the UPS, such as ST, SN, etc..
"options":{
"UPS":{
"bigText":"请填写长文本内容"
//"bigImageUrl":"Please fill in the url address of the big image"
}
}
name | type | required | default value | description |
---|---|---|---|---|
bigText | String | No | None | Notification display text + long text content in long text style |
bigImageUrl | String | No | None | Notify to display the big image content in big image style, fill in the URL address of the big image |