湛蓝的通知中心 - 应用程序卸载 [英] azure notification hubs - app uninstall

本文介绍了湛蓝的通知中心 - 应用程序卸载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用的Azure通知集线器发送推送通知,以在iOS,Android和Windows Phone上运行我的应用程序的用户。

I would like to use Azure Notification Hubs to send push notifications to users of my app running across iOS, Android and Windows Phone.

我设法获得工作的基础知识,但我不知道如何来管理应用程序卸载故事。

I have managed to get the basics working but I don't know how to manage the App uninstall story.

在开始,移动应用程序将调用我的身份SVC得到一个身份验证令牌。
然后调用它的平台通知服务(例如谷歌云通讯,APNS)来获取PNS令牌。
持续令牌到本地存储后它将调用后端联系SVC注册客户的设备。该服务将创建一个订阅设备的Azure的通知中心。

On starting, the mobile app will call my Identity Svc to get an Auth Token. It then calls its Platform Notification service (eg Google Cloud Messaging, APNS) to get a PNS Token. After persisting the token to local storage it will call a back-end Contact Svc to register the customer's device. This service will create a subscription to the Azure Notification hub for the device.

这是如下图所示:

后来后端发布服务将调用联系服务请求为特定的用户ID的推送通知。接触服务将查找分配给一个标签在通知中心Id和发送推送请求。

Later on a back-end publishing service will call the Contact Service requesting a push notification for a particular user id. The contact service will lookup the Id allocated to a tag on the notification hub and send a push request.

什么选项可用来确定当客户卸载应用程序?难道仅仅是一个在通知中心调用发送时捕获错误的事?我想,如果只发送给一个用户,但我的本意是,某些类型的信息将被发布到多个用户这可能是工作。在设备的初始注册订阅后,用户ID的标签,但也为更一般的标签,如新品推广创建。发布服务以后将要发出一个新的促销通知到所有设备。

What options are available to determine when a customer uninstalls the app? Is it just a matter of trapping errors when calling "Send" on the notification hub? I guess this could work if only sending to a single user but my intention is that certain message types are to be published to multiple subscribers. On the initial registration of a device a subscription will be created for a tag of the user id but also for a more general tag such as "New Promotion". The publishing service would later want to issue a "New Promotion" notification to all devices.

推荐答案

为什么你需要知道应用程序卸载?

Why do you need to know app uninstalls?

通知集线器自动失效注册的是还会卸载设备。
另外,我会避免在服务中坚持以PNSHandles所有。

Notification Hubs automatically expire registrations for devices that get uninstalled. Also, I would avoid persisting the PNSHandles in your service at all.

有关使用集线器目前的指导方针如下:

The current guidelines for using hubs are the following:

存储在本地存储器中的设备相关联的注册的registrationIds。这使您可以更新标签和一个更新呼叫信道的信息。
  因为移动连接并不总是可靠的,这是最好的,以避免不能够在registrationId存储在本地存储创建新的注册。这可能导致设备注册多​​次,导致重复的通知。您可以通过使用创建的注册ID并创建或更新注册REST API的实现这一目标。
  第一个API返回一个registrationId而不真正创建一个注册。当ID已经被安全地存储在存储设备,该设备可以调用创建或更新注册API。

store the registrationIds of the registrations associated with the device in local storage. This enables you to update tags and channel information with a single update call. Because mobile connections are not always reliable, it is best to avoid creating a new registration without being able to store the registrationId in local storage. This can result in the device registering multiple times, causing duplicate notifications. You can achieve this by using the Create Registration ID and Create or Update Registration REST APIs. The first API returns a registrationId without actually creating a registration. When the ID has been securely stored on the device storage, the device can call the Create or Update Registration API.

所以,我有你的ContactSvc公开两个功能:
一)建立注册ID(只需拨打中心得到它)
二)创建或更新注册给予(registrationId,pnsHandle,标签?)

So I would have your ContactSvc expose two functionalities: a) create registration id (just call hub to get it) b) create or update registration given (registrationId, pnsHandle, tags?)

然后将设备保持在REGID其存储,从广告获得PNS手柄后,如果因为REGID是不是有创建了端点的新一个),然后更新与pnsHandle和标签。

Then your device keeps the regId in its storage, ad after getting the handle from PNS, if as regId is not there creates a new one with endpoint a), then updates the registration with pnsHandle and tags.

请注意,以这种方式为您服务并不需要坚持手柄或的UUID,而不需要担心应用程序卸载。

Note that in this way your service does not need to persist handles or UUIDs, and does not need to worry about app uninstalls.

如果你正在跟踪用户,一种方法是定期(每月一次?)检查集线器如果注册仍然存在...

If you are keeping track of users, one approach is to periodically (once a month?) check in your hub if its registrations are still there...

您可以在@eliodamaggio达到我,如果这是不明确。

You can reach me at @eliodamaggio if this is not clear.

这篇关于湛蓝的通知中心 - 应用程序卸载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆