简体   繁体   English

Windows天蓝色通知中心TAGS

[英]windows azure notifications hub TAGS

I'm working with Windows Azure Notification Hub and Android, testing the notifications push service through GCM. 我正在使用Windows Azure Notification Hub和Android,通过GCM测试通知推送服务。 I'm using tags, pushing notifications from a Web aplication (back-end) integrated with Windows Azure, and subscribing from an Android App to listen to those tags. 我正在使用标签,从与Windows Azure集成的Web应用程序(后端)推送通知,并从Android应用程序订阅以侦听这些标签。

The issue is: I don't know how to unsubscribe from those tags. 问题是:我不知道如何退订这些标签。 Even when I restart the app in the emulator and without registering with GCM nor Azure I continue receiving notifications for each tag I have suscribed previously. 即使当我在模拟器中重新启动该应用程序且未在GCM或Azure中注册时,我仍会继续收到有关我先前订阅的每个标签的通知。

Where are these tags stored? 这些标签存储在哪里? how can I stop listening to those tags? 如何停止收听这些标签?

Also you can remove azure notification hub registration using Visual Studio (server explorer, azure, hubs, remove from device lists). 您也可以使用Visual Studio删除Azure通知中心注册(服务器资源管理器,Azure,中心,从设备列表中删除)。

Also if your GCM regenerated(or expired) notification hub removes registration when trying to send message on non-existent GCM. 同样,如果您的GCM重新生成(或过期)时,通知中心在尝试在不存在的GCM上发送消息时也删除了注册。

PS you shouldn't create new registration on hub any time you restart your app. PS,您不应该在重新启动应用程序时在集线器上创建新注册。 Better way - store regId on device and use it on backand to check if registration exists. 更好的方法-将regId存储在设备上,并在背面使用它,并检查是否存在注册。

Once you have received Registration Id from GCM it can be used to send messages to your application at any time even if application is restarted. 从GCM收到注册ID后,即使重新启动应用程序,它也可以随时用于向您的应用程序发送消息。

Basically, when you call NotificationHub.register(...) that Registration Id and tags specified are sent to your Azure Notification Hub (NH). 基本上,当您调用NotificationHub.register(...)时,指定的注册ID和标记将发送到您的Azure通知中心(NH)。 Then when your backend sends a message to tag "A" NH just scans its list of registrations looking for tag "A". 然后,当您的后端将消息发送到标签“ A”时,NH仅扫描其注册列表以查找标签“ A”。 Then all registrations with tag "A" are sent with the message via GCM endpoint. 然后,所有带有标签“ A”的注册都会通过GCM端点与消息一起发送。 So your application receives that message. 因此,您的应用程序会收到该消息。

To stop receiving notifications you can just call NotificationHub.unregister(...). 要停止接收通知,您只需调用NotificationHub.unregister(...)。

Also GCM can expire Registration Id after some time, then NH will figure it out and remove that Id from its DB. 此外,GCM可以在一段时间后使注册ID过期,然后NH将找出该ID并将其从DB中删除。

Also if application is not active for 90 days then NH automatically removes Registration Id from DB as expired. 另外,如果应用程序在90天内未处于活动状态,则NH会自动将过期的注册ID从数据库中删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM