Theme subscription push to help double eleven reservations to snap up

1 Introduction

Topic subscription push refers to pushing different news to users who have subscribed to different topics, such as photography, sports, food, etc. In order to improve user activity and retention, we hope to push different news according to the user's following topics. For example, for users who follow sports, we push sports-related information, so that the push varies from person to person and pushes the news that users are really interested in. .

2. Business background introduction

Each e-commerce platform on Double Eleven has launched various pre-ordering activities (as shown in the figure below). With the help of push notifications, merchants can send discount information to users’ mobile phones in a timely manner, but not all users are interested in products, and they are overwhelming. On the contrary, users will be disgusted by the push, and the theme push allows users to choose the products they are interested in to achieve accurate and timely push.

Insert picture description here

3. The overall process

Insert picture description here

4. Integrate key step instructions and codes

(1) Integrated push sdk

There is a detailed description on the integration document of Push sdk, which will not be expanded here. For details, please refer tohttps://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides-V5/service-introduction-0000001050040060-V5

(2) Configure automatic initialization token

After the automatic initialization is configured, the token will be returned from the onNewToken callback every time the application is opened. The theme push does not rely on the token for push, but the end test still needs to obtain the token first.

<meta-data
    android:name="push_kit_auto_init_enabled"
    android:value="true"/>

(3) Use the id of the product as the topic

When the user clicks to make an appointment, call the subscribe method to subscribe to the topic

/**
  * to subscribe to topics in asynchronous mode.
  */
 private void addTopic(String topic) {
     try {
         HmsMessaging.getInstance(MainActivity2.this)
                 .subscribe(topic)
                 .addOnCompleteListener(new OnCompleteListener<Void>() {
                     @Override
                     public void onComplete(Task<Void> task) {
                         if (task.isSuccessful()) {
                             Log.i(TAG, "subscribe Complete");
                             changToCancelAppointment();
                             isAppointment = true;

                             showLog("subscribe successful");
                         } else {
                             isAppointment = false;
                             changeToAppointment();
                             showLog("subscribe failed: ret=" + task.getException().getMessage());
                         }
                     }
                 });
     } catch (Exception e) {
         isAppointment = false;
         changeToAppointment();
         showLog("subscribe failed: exception=" + e.getMessage());
     }

 }

(4) The server calls the downlink message interface
to push the message with the topic of the product. The postman is used to simulate sending the message push message as follows:

(5) When a user makes a reservation for the pre-sale of a watch, he may have a purchase demand for other watches of the same price and the same style. We can push the pre-sale information of these watches to the user as a group. condition combination "condition": "'watch123456' in topics ||'watch321654' in topics ||'watch321684' in topics" If a user subscribes watch123456 watch32165 watch321684 one of the three watches, the sales information of the other two watches is also Will be pushed to users.

(6) When the user cancels the reservation for the sale of this watch, he can call the unsubscribe method to cancel the reservation. After cancellation, he will no longer receive the sale information of this watch.

 /**
  * to unsubscribe to topics in asynchronous mode.
  */
 private void deleteTopic(String topic) {
     try {
         HmsMessaging.getInstance(MainActivity2.this)
                 .unsubscribe(topic)
                 .addOnCompleteListener(new OnCompleteListener<Void>() {
                     @Override
                     public void onComplete(Task<Void> task) {
                         if (task.isSuccessful()) {
                             showLog("unsubscribe successful");
                             changeToAppointment();
                             isAppointment = false;
                         } else {
                             isAppointment = true;
                             showLog("unsubscribe failed: ret=" + task.getException().getMessage());
                             changToCancelAppointment();
                         }
                     }
                 });
     } catch (Exception e) {
         showLog("unsubscribe failed: exception=" + e.getMessage());
         isAppointment = true;
         changeToAppointment();
     }

 }

5. Effect display

Insert picture description here

6. Other

Topic messaging does not limit the number of subscriptions per topic. However, Push Kit has the following limitations:

(1) An application instance cannot subscribe to more than 2000 topics.

(2) Huawei devices above EMUI 10.0 require HMS Core (APK) version not lower than 3.0.0. On Huawei devices lower than EMUI 10.0, the version of HMS Core (APK) must not be lower than 4.0.3. The higher version of HMS Core (APK) complements the missing functions of the lower version of EMUI.

(3) The number of topics to be pushed at the same time cannot exceed 100.


Original link:
https://developer.huawei.com/consumer/cn/forum/topic/0204404702328700205?fid=18

Author: Pepper

Guess you like

Origin blog.51cto.com/14772288/2554005