Quick test notification message

最新の更新:2022-11-22

Send notification message in the background

Distribution collection: download postMan on the computer and then import link on the top left of the software:https://www.getpostman.com/collections/618d2460851f697dc22c

The notification format is as follows:

curl --location --request POST 'http://pricloud-master-api.glqas.mtpushoa.com/v3/push' \ --header 'Authorization: Basic MWM0Yjc0OWExN2Y2YWNhMzM5NjBhNTYwOjQ5ZjlkODI2MDExMmI0YmVlMDVhMzQzOA==' \ --header 'Content-Type: application/json' \ --data-raw '{ "platform": "android", "audience": { "registration_id": [ "1104a89792bbb659ec5" ] }, "notification": { "android": { "title": "notification title", "alert": "notification content", "builder_id": 0, "category": "alarm", "small_icon": "mtpush_notification_icon", "large_icon": "mtpush_notification_icon", "extras": { "notification key": "notification value" }, "priority": 1, "alert_type": 7, "sound": "coin", "channel_id": "money", "badge_add_num": 1, "badge_class": "com.engagelab.app.activity.MainActivity", "style": 2, "big_text": "Farewell to Cambridge is a popular poem of modern poet Xu Zhimo and a representative work of the New Moon School. The whole poem takes the emotional ups and downs when leaving Cambridge as a clue to express the deep feelings for leaving Cambridge. The language is light and soft, and the form is exquisite and mellow. The poet uses the method of combining the virtual and the real to describe the flowing pictures, which constitute a beautiful artistic conception everywhere. The poet's love for Cambridge, his nostalgia for the past life, and his helpless sorrow for parting in front of him are expressed in detail in a sincere, rich and meaningful way, which is the last song in Xu Zhimo's poems.", "inbox": { "inbox1": "this is inbox one", "inbox2": "this is inbox two", "inbox3": "this is inbox three" }, "big_pic_path": "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=96071541,1913562332&fm=26&gp=0.jpg", "intent": { "url": "intent:#Intent;component=com.engagelab.oaapp/com.engagelab.app.component.UserActivity400;end" } } }, "options": { "third_party_channel": { "vivo": { "classification": 1, "pushMode": 1 } } } }'
          curl --location --request POST 'http://pricloud-master-api.glqas.mtpushoa.com/v3/push' \
--header 'Authorization: Basic MWM0Yjc0OWExN2Y2YWNhMzM5NjBhNTYwOjQ5ZjlkODI2MDExMmI0YmVlMDVhMzQzOA==' \
--header 'Content-Type: application/json' \
--data-raw 
'{
    "platform": "android",
    "audience": {
        "registration_id": [
            "1104a89792bbb659ec5"
        ]
    },
    "notification": {
        "android": {
            "title": "notification title",
            "alert": "notification content",
            "builder_id": 0,
            "category": "alarm",
            "small_icon": "mtpush_notification_icon",
            "large_icon": "mtpush_notification_icon",
            "extras": {
                "notification key": "notification value"
            },
            "priority": 1,
            "alert_type": 7,
            "sound": "coin",
            "channel_id": "money",
            "badge_add_num": 1,
            "badge_class": "com.engagelab.app.activity.MainActivity",
            "style": 2,
            "big_text": "Farewell to Cambridge is a popular poem of modern poet Xu Zhimo and a representative work of the New Moon School. The whole poem takes the emotional ups and downs when leaving Cambridge as a clue to express the deep feelings for leaving Cambridge. The language is light and soft, and the form is exquisite and mellow. The poet uses the method of combining the virtual and the real to describe the flowing pictures, which constitute a beautiful artistic conception everywhere. The poet's love for Cambridge, his nostalgia for the past life, and his helpless sorrow for parting in front of him are expressed in detail in a sincere, rich and meaningful way, which is the last song in Xu Zhimo's poems.",
            "inbox": {
                "inbox1": "this is inbox one",
                "inbox2": "this is inbox two",
                "inbox3": "this is inbox three"
            },
            "big_pic_path": "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=96071541,1913562332&fm=26&gp=0.jpg",
            "intent": {
                "url": "intent:#Intent;component=com.engagelab.oaapp/com.engagelab.app.component.UserActivity400;end"
            }
        }
    },
    "options": {
        "third_party_channel": {
            "vivo": {
                "classification": 1,
                "pushMode": 1
            }
        }
    }
}'

        
このコードブロックは、フローティングウィンドウに表示されます

Parameter description

Properties supported channels type meaning
title all String optional,Title
alert all String required,Content
builder_id Engagelab only int optional. The id of the custom style. The system style is used by default.
category Engagelab only String
  • optional. The notification type. It is used to sort or filter notifications.
  • Various types, such as Notification.CATEGORY_ALARM and Notification#CATEGORY_CALL
  • large_icon Engagelab only String optional. Large icon. Generally, it is located on the right side of the notification.
    extras all JsonObject optional. Additional Fields. The key/value format is String.
    priority Engagelab only int optional. The urgency of the notification. Default value: 0.
  • Low level, no LED lights, vibration and ringtones are notified, Notification.PRIORITY_LOW:-1
  • normal, notifications can be LED lights, vibration and ringtones, Notification.PRIORITY_DEFAULT:0
  • advanced, the Notification can be LED light, vibration and ring tone, and can also pop up the floating window, Notification.PRIORITY_HIGH:1
  • alert_type Engagelab only int optional. Notifications are used for ringtones, vibration, and LED lights. The default value is Notification.DEFAULT_ALL:-1. Ringtone, Notification.DEFAULT_SOUND:1Vibration, Notification.DEFAULT_VIBRATE:2 LED lights, Notification.DEFAULT_LIGHTS:4 three scenes can be freely combined. For example, when it is 7, it means that there are ringtones, vibrations, and LED lights.
    sound Engagelab/google/xiaomi String
  • optional. The ringtone attached to the notification must be stored in the res/raw directory in advance.
  • Starting from Android8.0, the ringtone follows the channel. If no ringtone is set for the channel used by the notification, this notification will not take effect on the custom ringtone.
  • We recommend that you set the ringtone in the channel in advance. When you send a notification later, the sound is consistent with the ringtone in the channelId, so that the notification ringtone effect is consistent.
  • channel_id Engagelab/google/huawei/xiaomi /oppo String optional. It is required starting from Android8.0. If the sdk is not set in advance, it will help you set it up (only Engagelab channels and google channels when the application is in the foreground).
    badge_add_num Engagelab/huawei/xiaomi int optional. Increase the number of application corner labels and accumulate logic.
    badge_class Engagelab/huawei/xiaomi String optional. The application MainActivity is used for corner display.
    style Engagelab only int Optional. Notifications are used for ringtones, vibration, and LED lights. Three scenarios can be freely combined. Android 8.0, this attribute follows the channel. For example, if it is 7, it indicates that there are ringtones, vibration, and LED lights. The default value is Notification.DEFAULT_ALL:-1.
  • Ringtone, Notification.DEFAULT_SOUND:1
  • vibration, Notification.DEFAULT_VIBRATE:2
  • LED lights, Notification.DEFAULT_LIGHTS:4
  • big_text Engagelab only String optional. Large text. The style is NOTIFICATION_STYLE_BIG_TEXT.
    inbox Engagelab only JsonObject optional. Inbox. The style is NOTIFICATION_STYLE_INBOX.
    big_pic_path Engagelab only String optional. Large image. The style is NOTIFICATION_STYLE_BIG_PICTURE.
    Intent:url all String optional. MTPush4.0.0 takes effect. Click the notification (Engagelab + all vendors) and then jump. Currently, only activity is supported. Intent.toURI() converted

    Sample code for configuring activity on Android client:

    package com.engagelab.app.component; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; import android.widget.Toast; import com.engagelab.app.R; import com.engagelab.app.log.ExampleLogger; import com.engagelab.privates.push.api.MTPushPrivatesApi; import com.engagelab.privates.push.api.NotificationMessage; import com.engagelab.privates.push.constants.MTPushConstants; /** * Used to demonstrate - click the notification to jump to the activity * * Make sure there is no call{@link MTPushPrivatesApi#configOldPushVersion(Context)},Otherwise, click "Jump" and the notice will not jump to this page * <p> * no need to call {@link MTPushPrivatesApi#reportNotificationOpened(Context, String, byte, String)},The sdk has been processed internally */ public class UserActivity400 extends Activity { private static final String TAG = "UserActivity400"; private TextView tvMessage; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_intent); tvMessage = findViewById(R.id.tv_message); onIntent(getIntent()); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); onIntent(intent); } private void onIntent(Intent intent) { try { Toast.makeText(this, TAG, Toast.LENGTH_SHORT).show(); if (intent == null) { return; } Bundle bundle = intent.getExtras(); NotificationMessage notificationMessage = bundle.getParcelable("message"); if (notificationMessage == null) { return; } ExampleLogger.d(TAG, "notificationMessage:" + notificationMessage.toString()); tvMessage.setText(notificationMessage.toString()); } catch (Throwable throwable) { throwable.printStackTrace(); } } }
              package com.engagelab.app.component;
    
    import android.app.Activity;
    import android.content.Context;
    import android.content.Intent;
    import android.os.Bundle;
    import android.widget.TextView;
    import android.widget.Toast;
    
    import com.engagelab.app.R;
    import com.engagelab.app.log.ExampleLogger;
    import com.engagelab.privates.push.api.MTPushPrivatesApi;
    import com.engagelab.privates.push.api.NotificationMessage;
    import com.engagelab.privates.push.constants.MTPushConstants;
    
    /**
     * Used to demonstrate - click the notification to jump to the activity
     *
     * Make sure there is no call{@link MTPushPrivatesApi#configOldPushVersion(Context)},Otherwise, click "Jump" and the notice will not jump to this page
     * <p>
     * no need to call {@link MTPushPrivatesApi#reportNotificationOpened(Context, String, byte, String)},The sdk has been processed internally
     */
    public class UserActivity400 extends Activity {
    
        private static final String TAG = "UserActivity400";
    
        private TextView tvMessage;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_intent);
            tvMessage = findViewById(R.id.tv_message);
            onIntent(getIntent());
        }
    
        @Override
        protected void onNewIntent(Intent intent) {
            super.onNewIntent(intent);
            onIntent(intent);
        }
    
        private void onIntent(Intent intent) {
            try {
                Toast.makeText(this, TAG, Toast.LENGTH_SHORT).show();
                if (intent == null) {
                    return;
                }
                Bundle bundle = intent.getExtras();
                NotificationMessage notificationMessage = bundle.getParcelable("message");
                if (notificationMessage == null) {
                    return;
                }
                ExampleLogger.d(TAG, "notificationMessage:" + notificationMessage.toString());
                tvMessage.setText(notificationMessage.toString());
            } catch (Throwable throwable) {
                throwable.printStackTrace();
            }
        }
    
    }
    
            
    このコードブロックは、フローティングウィンドウに表示されます
    <!-- Click to jump to the notification for demonstrating and later versions --> <activity android:name="com.engagelab.app.component.UserActivity400" android:exported="false" android:launchMode="singleTask" /> <!--Local transit verification of white list: Start from MTPush4.2.3 and configure ENGAGELAB_ PRIVATES_ After TRANSFER, the SDK will perform local verification; No local authentication is performed without configuration. If local verification is enabled, configure the target activity to jump here; If there are multiple target activities, use/to separate them.--> <meta-data android:name="ENGAGELAB_PRIVATES_TRANSFER" android:value="com.engagelab.app.component.UserActivity400" />
                      <!-- Click to jump to the notification for demonstrating and later versions -->
            <activity
                android:name="com.engagelab.app.component.UserActivity400"
                android:exported="false"
                android:launchMode="singleTask" />
            <!--Local transit verification of white list: Start from MTPush4.2.3 and configure ENGAGELAB_ PRIVATES_ After TRANSFER, the SDK will perform local verification; No local authentication is performed without configuration. If local verification is enabled, configure the target activity to jump here; If there are multiple target activities, use/to separate them.-->
            <meta-data
                android:name="ENGAGELAB_PRIVATES_TRANSFER"
                android:value="com.engagelab.app.component.UserActivity400" />
    
            
    このコードブロックは、フローティングウィンドウに表示されます
    在文档中心打开
    icon
    営業に連絡する