preface

The domestic Android push is a tragedy

Domestic Android lacks Google’s ecosystem, such as Google’s Paly Store, Google Mobile Services (GSM), etc., resulting in the birth of many malformed industries, such as multifarious APP market and bizarre push platform. Here I want to talk about push platform. Google’s OWN GSM service contains a set of push, which is similar to the push of iOS system. It guarantees that each mobile phone can receive push from all parties by maintaining a push channel. However, because Google cannot enter the Chinese market, a core component of Domestic Android is basically emasculated, resulting in numerous abuses. The first is push.

Domestic mobile phone manufacturers basically have their own push service to replace the absence of GSM, with uneven performance and usage. In offline scenarios (APP death), if you want to receive a push, you must access the corresponding vendor’s push service, otherwise you will not receive it at all. Therefore, Android APP should integrate Huawei push, Xiaomi Push, Meizu Push, OPPO Push and Vivo push at the beginning of its birth. Compared with GSM, Android APP is complex and has no gain, just like replacing Huang Laoxie with Jiangnan Seven monsters, which is difficult to use yiB. However, you have no choice. However, various domestic manufacturers are not tired of this, they have a more reach users and statistics channels, and can not be controlled by Google, for developers, it will be a lot of trouble, the workload of white many times; Some chat apps in order to push their own SDK, but also to consider a variety of black technology: package activities, apps evoke each other, etc., evil flowers bloom everywhere. More interesting is, in order to solve this problem, formulate norms, but also promote the birth of a variety of organizations, such as push alliance, green alliance, etc., but nothing useless, founded three years, chaos is still, many say that Android is rubbish, that push this problem is responsible for more than half.

After the teasing, you still have to answer.

Push the concept

Why do I have to receive the SDK pushed by the manufacturer? Can not receive push without access? Push: its point is push, and its corresponding is Pull. The core is that the client and the server establish a long link, and the server will distribute information to each client. The simplification is shown as follows:

For mobile APP, push can be classified into online push or offline push, which is actually whether the APP is alive or not. In the case of APP survival, there are many choices. If the APP establishes a link with its own server through Socket, it can be directly pushed to the APP by its own server, or it can be pushed to the third-party push service through the back end. By pushing it to the APP by a third party, that is, online, you do not need to access the SDK of a third party. However, in the case of APP death, there is only one way: push the APP to the mobile phone through the third-party push service. In this scenario, the APP must access the SDK of a third-party manufacturer. Take Huawei platform as an example, and its push model is as follows:

There are also two corresponding concepts of messages: transparent messages and notification messages:

  • Transparent message: When the APP is alive, the push service directly sends the message to the APP, and the APP can choose how to process the message. Note that transparent message is transmitted only when the APP is alive and does not need to access a third-party SDK.

  • Notification bar message: After the device receives the message, the system pops up a standard Android notification, and the user clicks the notification bar to activate the APP. In this scenario, the APP does not need to survive (alive and not affected). In offline scenarios, there is only notification bar message.

Each APP maintains one channel for transparent message, and only one system channel for offline message. A brief comparison of the two is shown as follows:

For online transparent transmission messages, as they are received when the APP is still alive, the APP end can collect all necessary information, whether it is the time of push, push content or the click of the notification. However, offline push is not so lucky. Many information apps cannot get by themselves. However, the business side is usually very concerned about the arrival rate and click rate, so it must have an effective solution.

Push statistics problem (offline push)

How to reach rate

Online push is not considered here, only offline (APP death), so can offline push APP statistics arrive?

The answer is no, the reason is actually very simple, APP processes are dead, how to count. In this case, the display of notifications is a system behavior that the APP can’t perceive at all, let alone count. However, each three-party push service platform provides the ability of push arrival statistics, that is, the receipt of the three-party push platform is adopted. Take huawei’s push model as an example:

It can be seen that in the case of offline Push, Huawei device will send a return receipt to Huawei Push service after displaying the notification bar message, and Huawei Push service will send the return receipt head to the developer server, so that the APP server can judge whether the Push has arrived.

How to count the click-through rate

Also, in the offline push scenario, can click events be counted? About this scene, different vendors ROM and SDK is really a mess, some support, some do not, briefly sorted out as follows:

ROM millet huawei meizu oppo vivo
Whether the App can count offline click events is no is no is

Therefore, the methods provided by various platforms are not of much reference significance, and clicks must be counted in other ways. Offline push is basically handled by scheme, which can be solved by adding parameters, which will be detailed later.

Push delivery rate = the number of devices actually delivered in this push/the number of all devices covered (supposedly, invalid devices should be removed)

What factors affect delivery rate

    1. Retention rates. The APP has been uninstalled, so it certainly cannot be received. However, some third-party platforms may come down to the denominator and need their own background to manually clear regID according to the receipt.
    1. Basically, all third-party PUSH platforms support setting the validity period. The shorter the validity period is, the fewer devices will be reached and the delivery rate will decline. Therefore, the valid time can be appropriately selected.
    1. Networking, during the validity period, the device is not connected and cannot be delivered, but it will be counted in the denominator
    1. When selecting devices for target groups, the device delivery rate of active groups is definitely higher than that of full push

Therefore, in order to accurately calculate the delivery rate, the APP server should regularly clear invalid regID (push token); otherwise, the statistical delivery rate will also be low

Offline push platform access information

Many large companies have their own Push SDKS to handle passthrough messages, while small companies generally do not have this capability, so there are two situations when accessing Push.

  • 1: have their own add PushSDK,
  • 2: no own PushSDK

If the APP has its own PushSDK, then as long as access to the third-party offline push ability, some of the processing configuration of passthrough can be completely ignored, with their own PushSDK that can be. If you do not have your own PushSDK, you need to choose an SDK for transparent transmission processing, of course, still need to access the third-party offline push ability. However, the access rules of each ROM are also different. For example, Xiaomi has a strange permission called “background pop-up interface permission”. If the Push posture of the back-end service is not correct, strange problems may be introduced: for example, the mobile phone can receive Push, but can not pull the interface, which is a mess.

A brief look at each ROM into the considerations, only look at the offline ability, not considering transparent transmission:

millet

As for MIPUSH access, you can directly read the official document, and there are not too many problems. It should be noted that Xiaomi has a strange permission setting: the background popup interface permission, which is turned off by default. This option may affect the click behavior of push notification.

Fully custom click behavior

Under this kind of behavior, the developers can intercept notify the click event, custom how to deal with the subsequent events, click later, MiPushMessage through PushMessageReceiver onNotificationMessageClicked method of the derived class to APP process, If you want to launch the interface, you can just call the context.startActivity method in it, but this custom behavior is affected by background pop-up permissions, especially in older versions of MIUI ROMs.

You will find that on these phones, this method does not start the APP at all, except by starting a Service and then pulling it up in the Service, which is very similar to a BUG of Xiaomi. Moreover, even if it can be pulled up through this strategy, you will find that the pulling speed is very slow, which may be caused by too many AMS interactive communication. So this strategy is dead.

Predefined click behavior

Predefined click behavior without user in onNotificationMessageClicked processing, the system will pull up directly to the target page, millet support three predefined click behavior:

  • (1) Start the current Launcher Activity
  • (2) Start any Activity in the current APP
  • (3) Open the web page.

Apps typically use the second behavior, which is to open any Activity in the APP and actually select a DeepLink Activity and route it to another interface. The server calls the extra(String key, String value) method of the message. Builder class and sets key to Constants.EXTRA_PARAM_NOTIFY_EFFECT, NOTIFY_ACTIVITY is achieved with value set to Constants.NOTIFY_ACTIVITY. After the user clicks on the notification message that pops up from the client, the MiPushMessage object that encapsulates the message is passed to the client through the Intent, which the client can parse in the Activity and handle the subsequent flow itself. In offline push, the core fields of the push server are as follows:

Adopting offline non-transparent message and using extra to customize Click behavior, the message format pushed to Xiaomi is simplified as follows:

{title= notification title, description= notification content, restrictedPackageNames=[com.test.example], notifyType=1, notifyId=1249808047, <! - open any Activity configuration - > extra. Intent_uri = yanxuan: / / re? OpOrderId = crm_a1d05c1d3d1743e192a08b461a376785_20200715, extra.notify_effect=2 }Copy the code

The value of extra.intent_uri is the private scheme defined on the APP side. Clicking on the notification will directly pull up the corresponding DeepLink Activity, thus evoking the application. This can be resolved from extra.intent_uri. For the problem that the click event is not easy to count mentioned in the previous layer, it can be solved by using the scheme parameter as follows:

extra.intent_uri= yanxuan://re?opOrderId=0200715, 
Copy the code

to

extra.intent_uri= yanxuan://re?opOrderId=0200715&platform=xiaomi 
Copy the code

The platform parameter can then be parsed in the routing Activity to mark the click event and the platform from which it originated. Predefined behavior system will help us to deal with, in the APP, don’t need onNotificationMessageClicked in response to the click event again, avoid repetition. The rest of the SDK capabilities are basically similar to Xiaomi, more or less the same, not much variety.

huawei

The process is similar to xiaomi, which can be followed by the document. The predefined behaviors are as follows:

  • 1: user-defined Uri, open the target page
  • 2: Click to open a specific web page
  • 3: Click to open the application
  • 4: Click to open rich media information

Typically, custom URIs are selected, and all data is transmitted to the APP via intent URIs, which is still the DeepLink implementation of private Schemes. The meanings of the parameters are as follows:

Basically, select type=1 with the intent URI, which is generated in the following format:

Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("pushscheme://com.huawei.codelabpush/deeplink? name=abc&age=180")); String intentUri = intent.toUri(Intent.URI_INTENT_SCHEME);Copy the code

Finally, the data format sent to Huawei push platform through API is simplified as follows:

"msg":{ "action":{ "param":{ "intent":"intent://member? url=http%3A%2F%2Fm.you.163.com%2Fmembership%2Findex&_yanxuan_hwpush=1&_mid=a397314518947995648#Intent; scheme=yanxuan; launchFlags=0x4000000; End "}, "type" : 1}, "body" : {" title ":" huawei from postal coupons gift bag ", "content" : "quick to pick up your monthly exclusive free shipping coupon, immediately get > >"}}Copy the code

Similar to xiaomi, if additional parameters need to be added, they are put into Scheme instead of being stated.

meizu

Access is similar and supports four predefined behaviors:

  • Open the app home page
  • Open the in-app page
  • Open URI page
  • Client customization

Also, select the predefined Uri page and set the parameters as follows

The final data format is simplified as follows:

{noticeBarType = 0, title = 'meizu after tomorrow ⏰ restore the original price ', content = 'laihua hot style return! Latex mattress straight down 500, pull rod box only 30% off! 😱 clickType = 2, url = 'yanxuan://yxwebview? url=https%3A%2F%2Fact.you.163.com%2Fact%2Fpub%2FDisjY2u1n9p4SB3.html%3Fanchor%3DSeen3xcj%26opOrderId%3Dcrm_task_20200414 160053263 _1 '}Copy the code

ClickType = 2 is implemented in conjunction with the Uri scheme, pre-defined to pull up the corresponding interface, if additional parameters need to be added, same as above.

oppo

Similarly, opPO is not aware of the click event and supports five predefined behaviors (with redundancy) :

  • 0, start the application.
  • 1, Open the app’s intent action
  • 2. open the web page.
  • 4. Open the app page (using the activity’s full name)
  • 5, Intent scheme URL

Similarly, select click_action_type and select 5 to pull up APP through private Scheme. The specific data format is as follows

{ "notification":{ "app_message_id":"a467798011733344256", "channel_id":"NotificationChannel", "click_action_url":"yanxuan://yxwebview? url=https%3A%2F%2Fact.you.163.com%2Fact%2Fpub%2FDisjY2u1n9p4SB3.html%3Fanchor%3DSeen3xcj%26opOrderId%3Dcrm_task_20200414 160053263_1", "click_action_type":5, "Content ":" restore original price after tomorrow ", "title":" restore original price after tomorrow"}, "target_type":2, "target_value":"CN_04f112241e183f6309611df2a95d6237" }Copy the code

Click_action_type = 5 Pulls up APP with Scheme, and if additional parameters need to be added, same as above.

vivo

Vivo is very similar to Oppo, but it can also receive click events (not really useful), so it supports full customization (but not) and supports 5 click behaviors

  • 1: Open the APP home page
  • 2: Open the link
  • 3: user-defined
  • 4: Open the specified page within the app

Similarly, in order to prevent background startup from being prohibited, the specified page in app is opened directly instead of being customized. “skipType”:4,

{ "classification":1, "content":"adssdsr345436", "notifyType":1, "pushMode":1, "regId":"15905547110541891320627", "requestId":"a467798011733344256", "skipContent":"yanxuan://yxwebview? url=https%3A%2F%2Fact.you.163.com%2Fact%2Fpub%2FDisjY2u1n9p4SB3.html%3Fanchor%3DSeen3xcj%26opOrderId%3Dcrm_task_20200414 160053263_1", "skipType":4, "title":"adssdsr345436" }Copy the code

SkipType :4 Pull APP together with Scheme, and if additional parameters need to be added, same as above.

Summary of ROM access matters

The above are several offline push access methods, and the overall summary is as follows:

  • Use predefined Uri schemes rather than user-defined ones
  • You can add parameters to Scheme to identify click events uniformly
  • Do not reprocess events in the click callback in a predefined manner
  • There is no need to deal with pass-through configurations (such as Receiver Service) if only offline push is required.

conclusion

  • Had to access a third party SDK for offline push
  • Offline push is similar to offline push. It is recommended that predefined URIs and private schemes be used to pull up apps
  • Additional trace parameters can be resolved by adding a Scheme field
  • Different ROMs may have their own additional restrictions, such as xiaomi, and try to avoid them

Finally, Android’s push dilemma is a tragedy…