This article has launched the first wechat public account “Code Xiaosheng”, you can search for attention, focus on Android technology sharing.

origin

Add push function to the APP a while ago, after investigation and research to receive as a result of the integration push the SDK, the use is very good with a probability from the market, after all, a push, tencent TPNS (formerly known as pigeons), aurora, and their Allies are relatively popular in the producer services, but for developers, more important is the official document is easier to read? Is it convenient to communicate with official customer service? , a good documentation can save a lot of money, I believe the developers will be well aware of it.

problems

A push Android integration official documentation: https://docs.getui.com/getui/mobile/android/androidstudio/

After the integration is completed according to the above documents, no matter which model, the manufacturer’s token can always be obtained, but clientId can, which is the first problem.

There are two ways to view vendor tokens. These two ways are not in the integration documentation, but in Android FAQs.

  1. When the mobile phone is connected to the computer, you need to open developer debugging mode, open APP, and filter “Assist_” in the androidstudio compiler logcat. If the token information is successfully printed, it indicates that the vendor integration is normal.
  2. In the background [message push] – [Configuration Management] – [Application Configuration], fill in and save the manufacturer parameters normally. Then enter CID query in “Push message” – “Configuration Management” – “Troubleshooting” – “Check CID status and information:” to see whether the vendor token will be returned.

Public void onReceiveDeviceToken(Context Context, String deviceToken) public void onReceiveDeviceToken(Context Context, String deviceToken) However, this method can be used only if the vendor token has been obtained, so there is no problem to check.

Careful attention should be paid to the details of the above two approaches: vendor integration and saving vendor parameters.

It is very clear about saving manufacturer parameters. It can be seen in the background that currently only mainstream phone manufacturer channels (Huawei, Xiaomi, OPPO, VIVO and overseas channels) are provided, as shown in the figure:

What we need to do is to find our app in each app market (because my app is already on the shelves, if it is newly created, it is suggested to open it when it is created) and open the push service for it. Note that Huawei requires an additional step: configure the SHA256 value in the application signature information (huawei has provided a tutorial on how to obtain the SHA256 value for the application already in the shelf).

This step still does not obtain the vendor’s token, thus bringing the following experience:

The server sends push notifications, which can be received when the mobile phone is online but cannot be received when the mobile phone is offline. The sending code of the server side sends both notification and transparent message. Therefore, the sending code of the server side does not need to be modified. It is written according to the demo.

Here’s another question: what is passthrough messaging? How to understand pass-through?

The correct understanding of pass-through message is to cooperate with mobile phone manufacturers, and the message will go through the channel of each mobile phone manufacturer, rather than just pushing its own channel. Pass-through does not have the meaning of “penetration, strength, strength, and advanced”, so don’t misunderstand it. Transparent messages and notifications are different types of message delivery methods in the same class.

Since it was my first integration and I was also helping with the project, I didn’t look too closely and only took what was needed for integration. The advantage was that the relevant personnel pulled everyone to the official technical support group, so I threw a lot of questions later, but basically didn’t answer the questions.

When I configured vendor parameters earlier, I also noticed that when OPPO or Vivo opened push service, there would be an explanation of transparent message. At that time, I felt that there was a deviation in my guidance from the back end. After communication with technical support, the results were confirmed as follows:

  • Transparent messages can only be received online. Offline messages are not received at all
  • Offline notifications are received, not transparent messages

This makes it clear that the previous practice had been to obsess over why pass-through messages were not received offline, because I was misinformed by the back end that pass-through should be received offline, meaning penetration, which is more advanced than notification, which is why I emphasized the understanding of pass-through earlier.

Further, according to the feedback of technical support, the client does not need to deal with the display and clicking of the notification. The client only needs to configure icon and text in strict accordance with the requirements of the document, and the server can specify the skipping page when sending the notification. If the skipping page is not specified, the APP homepage will be redirected by default. The display of transparent message needs to be processed by the client, that is, the operation of displaying the notification bar, but clicking the jump also does not need to be done by the client.

Search for solutions

At this point, the basic thinking and logic are clear, but two questions remain:

  1. How is vendor integration done? Where is it?
  2. Why cannot I obtain the device token? According to the official tip, if the device token cannot be obtained, the app must not receive notification when offline.

These two problems are only triggered when the APP is offline. In fact, these two problems are ultimately the same problem, that is, the manufacturer is not integrated. So here’s the problem. I went through the Android integration documentation, which I linked to at the beginning of this article, but I couldn’t find the steps for the integration vendor, so I fell into a pit. I checked the relevant documents of push service in each app market, checked the configuration switch of each push service, tried release test, changed to mainstream phone test, and asked official technical support, but I got nothing. The most common reply from technical support was this:

This screenshot is actually the fourth Android FAQ.

But that’s bullshit. I know where the problem is. I just want to know where the vendor integration is. I want to document or link, finally really can not do, ready to do the final battle, directly @ twitter official technical support direct link, result threw me a link I have never met: On the https://docs.getui.com/getui/mobile/vendor/androidstudio/, found that this too pit, moment want to scold or two, but refrained, because I recently is reading a book “life is a spiritual” ha ha.

Let’s take a look at the overall distribution of official documents:

The relationship between Android and multiple vendors is even, and what’s even more hateful is that before integrating multiple vendors, you must first integrate Android and push the SDK, which is what we did before. After following the document, I found the coveted Device token on the console. Then I checked the manufacturer’s token according to clientId, and there was a value. It should be noted that the offline test must be officially supported mainstream models (previously configured models). Huawei requires a release version to test the results.

After solving the problem, I offered suggestions to the official technical support:

There should be a mention of multi-vendor integration in the Android integration documentation, or at least a hyperlink. The response was that they suggested something, so I knew they were probably not directly tweeting official technology.

conclusion

There were two major mistakes in this climb;

  1. Not knowing the purpose of the term in advance and being misunderstood
  2. Be aware of the technical support provided (a lot of it is business, not official)

As an added bonus, when integrating with multiple vendors, you encounter an Intent value for a server configuration message (notification and passthrough message) click event.

The red part of the configuration is exactly the way mentioned in the Android integration documentation, but it is not recommended here. For the sake of security, ACCORDING to the official generation method, I sent it to the backend after the android terminal was generated.

I hope I can help you if you have any questions in this article. This article is over.

I am a code student, you can click a like, comment, thank you ~