如果安装ID未知,如何更新安装? [英] How to update an installation if installation id is unknown?

查看:70
本文介绍了如果安装ID未知,如何更新安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某些原因,无法下载所有安装.因此,如果不知道所有安装ID,该如何为所有安装更新模板?

For some reason, one cannot download all installations. So, how does one go about updating a template for all installations if one doesn't know all the installation ids?

肯定有人想到了...?

Surely someone thought of this...?

推荐答案

使用NotificationHubs时有两种选择:直接向NotificationHub注册设备,或通过Web后端注册设备.

There are two options when using NotificationHubs: register a device directly with the NotificationHub, or register a device through your web backend.

如果您要直接从设备上向NotificationHub注册,那么在需要为所有安装更新模板时将会遇到麻烦.据我所知,在这种情况下,您是SOL.

If you're registering directly with the NotificationHub from a device, you're going to have a bad time when you need to update a template for all installations. To my knowledge, you're SOL in this case.

如果要从后端向NotificationHub注册,则可以选择.您需要在单独的数据存储中保留每个安装的列表.例如,在我的上一个项目中,我保留了一个PushNotificationRegistrations数据库表,其中包含PNS类型(gcm,apns),registrationId(来自各个PNS的唯一设备注册),userId(因此以后可以根据需要交换标签)),以及生成的installationId.

If you're registering with the NotificationHub from your backend, you have options. You'll need to keep a list of every installation in a separate data store. For example, on my last project, I kept a PushNotificationRegistrations database table that contained the PNS type (gcm, apns), the registrationId (the unique device registration from the respective PNS), the userId (so I could swap out tags as needed later), and a generated installationId.

如果每次注册都有此信息,则可以从数据存储中检索相关记录,然后在一个巨大的decade废循环中使用NotificationHub重新注册每个记录.安装是幂等的,因此这将覆盖旧模板.我认为,您需要确保重新注册时的InstallationId和注册ID相同.

If you've got this information for each registration, you can retrieve the relevant records from your data store, then re-register each with the NotificationHub in one big giant decadent for-loop. Installations are idempotent, so this will overwrite old templates. I think that you need to ensure that your InstallationId and registration Id are the same when you re-register.

我记得在REST文档中看到了一些有关使用HTTP PATCH端点仅定位安装部分的信息,但是我还没有尝试过.

I remember seeing something in the REST docs about using a HTTP PATCH endpoint to just target portions of an installation, but I haven't experimented with them.

这篇关于如果安装ID未知,如何更新安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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