Azure 移动服务 PushNotifications 设备注册

Posted

技术标签:

【中文标题】Azure 移动服务 PushNotifications 设备注册【英文标题】:Azure Mobile Services PushNotifications Device registration 【发布时间】:2015-05-08 11:16:10 【问题描述】:

我正在构建基于 AzureMobileServices 的应用程序。但是我遇到了以下问题。

由于某些原因,每个 AzureMobileService 应用程序需要几个集线器(它将被少数 ios 应用程序使用,因此需要使用不同的 APNS 证书)。

我已经实现了通过必要的集线器发送通知的逻辑,但是设备注册继续使用来自 web.config 的连接字符串。

是否有任何方法可以处理设备注册过程以使设备注册为必要的集线器?

【问题讨论】:

【参考方案1】:

通过通知中心直接支持多租户,因此客户端在执行操作时需要直接连接到各个中心。如果设备注册使用相同的连接字符串,很可能您正在使用移动服务的(移动应用程序)推送客户端。你介意检查一下吗?

get started iOS tutorial 有一个可以提供帮助的 sn-p:

SBNotificationHub* hub = [[SBNotificationHub alloc] initWithConnectionString:
                          @"<connection string>" notificationHubPath:@"mynh"];

[hub registerNativeWithDeviceToken:deviceToken tags:nil completion:^(NSError* error) 
    if (error != nil) 
        NSLog(@"Error registering for notifications: %@", error);
    
];

【讨论】:

我们认为直接在应用程序中保存连接字符串不是好方法,因此我们在后端实现了设备注册逻辑。它对我们很有用。

以上是关于Azure 移动服务 PushNotifications 设备注册的主要内容,如果未能解决你的问题,请参考以下文章

Azure 移动服务(推送通知)

如何从 Azure 移动应用服务调用 HTTP(Azure Functions)?

推送通知 Azure 移动服务(自托管)

Azure 移动应用服务安全

Azure 移动服务:无数据选项卡

Xamarin MonoAndroid Azure 移动服务 InsertAsync