How do you use the alias in the Friend League push? Can you interpret it as an account? Our app has its own account system, want to send a welcome message to the user every time the user logs in. Look at the friend League push, there is a concept called Alias (alias), but the official document says alias is tied to the device, feeling alias is not a strict account. Do not know the other integration of the Friends of the alliance to push the brothers have similar needs, whether you can through the Friend Alliance to provide the alias function to meet our needs? Desert
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Answer your question in two parts, the first part is the understanding of the need in your question, and the second part focuses on how to design alias and use Alias's best practice:
Your requirement is to send a welcome message to the user every time the user logs in. If the welcome message is fixed, then you can implement the logic locally in the app (which is easy to implement), rather than using a message push approach. It makes sense to use push if the welcome message is to make some personal welcome, or to control the welcome language on your server side. According to your description, feel that your needs are to do personalized push.
The next step is to introduce the idea of the friend Alliance push to design alias at the product level, which will help the questioner to better understand and use alias. In our official documentation, alias is defined as "device alias, which binds the alias to the device, making it easy for some app developers to use their own account or third-party account system for message push". The definition involves several important points:
- First of all, alias is bound with the device, the Friend League push to the device identification is device-token, that is, alias and friends of the Union Device-token is bound corresponding. At this level, alias can be a developer's account system (including a third-party account system), a developer's own identity system for the device (such as Imei+mac on an Android device), or an ID system that other developers can guarantee to be unique, which is the developer's own decision. The question asks whether alias can be understood as an account system, and in a narrow sense it can be understood that, in fact, the friend League push gives alias more flexibility.
- Secondly, combined with the more and more apps to provide the third party social platform account Landing features, we in alias Design also fully consider the account requirements, so in the official document, we mentioned in the use of alias, we must associate a alias_type, If it is a developer's custom alias (including the own account system), this alias_type can be arbitrarily defined, if the use of third-party account system, we pre-provided more than 20 kinds of mainstream open platform account type, such as Sina Weibo (Sina_weibo), (Weixin) and so on. fill in the role of Alias_type is, friends of the League and Friends of the Alliance social sharing services to do data on the open, better from the data level to play value, for the developer services. In this case, let's take a second look at the concept of alias, aliases + alias type (Alias_type) and device bindings.
- Finally, let's talk about the usage of alias, which is something that developers are very concerned about. Our alias binding operation is provided on the SDK side, developers only need to invoke Mpushagent.addalias (alias, Alias_type) interface on the SDK side, the league push SDK is responsible for the Alias+alias_ The type is bound to the device-token of the Friend Alliance, and the binding relationship is uploaded back to the friend's backend server. Then developers can according to their own business logic, tune the server-side interface, according to alias to do personalized push. For example, users want to implement the user login personalized push, can be in the user's first landing (this very good judgment), the developer in the app call the alias binding interface to do the binding, and each time the user logs in, the developer's server will trigger a login event, Developers on their server side according to alias do "Welcome words" to send. As a result, alias's role is to allow developers to combine their own accounts (here need to understand the broad account) system, to do more personalized, sophisticated push. is a simplified alias schema to help you understand the use of alias:
&lt;img src= "https://pic4.zhimg.com/d14c21f4d4c2bce62215312aa55f930b_b.jpg" data-rawwidth= "918" data-rawheight= "767" class= "Origin_image zh-lightbox-thumb" width= "918" data-original= "https://pic4.zhimg.com/ D14c21f4d4c2bce62215312aa55f930b_r.jpg "&gt;
On the interface of alias, our friend Alliance message push Android document provides a very rich interface for developers to invoke:
添加AliasmPushAgent.addAlias("[email protected]", ALIAS_TYPE.SINA_WEIBO);移除AliasmPushAgent.removeAlias("[email protected]", ALIAS_TYPE.SINA_WEIBO);
Note that in the app server side tune the server side interface to do push, do not forget to pass in alias_type parameters.
About alias Basic topic almost explained clearly, finally and everyone in-depth talk about alias as an account system involving multi-account multi-device landing problem, this time, alias_type come in handy, I believe that after reading this chapter, We will have a deeper understanding of the design mechanism of our alias:
- 1. Multiple accounts logged into the same device, specifically divided into two types of case:
- If it is the same alias_type, then the last bound alias will prevail. For example: (Alias_a, alias_type_a) first made a binding, then (Alias_b, alias_type_a) after the binding, then, if this time to send a message to Alias_a, the device will not receive the message, Because in the friend League push backstage Device-token is and the last landing alias_b do bind. This is also true in the actual business scenario, the last login account is the current real user of this device.
- If it is not the same alias_type, then the two binding alias will take effect. For example: (Alias_a, Alias_type_a) first did the binding, then is (Alias_b, alias_type_b) did the binding, then whether to send messages to alias_a, or send messages to Alias_b, the device can receive messages. Because the alias_type changes, the friends of the push back to the background can not determine this is the same user (eg: the same user with different platform account login), or different users (different users, using different accounts login), friends can only easily determine the two different Alias_ The type's account number is two different accounts. This scenario requires special attention, and it is recommended that developers avoid this usage scenario as much as possible during the actual integration process.
- 2. Login multiple devices with one account:
- This situation is easier to deal with, where an alias and multiple Device-token are bound. If we send a message to this alias, we will send the message to all the devices that are bound to this alias.
How do you use the alias in the Friend League push? Can you interpret it as an account?