繁体   English   中英

如何从ListEndpointsByPlatformApplication Amazon SNS C#获取用户数据

[英]How to get User Data from ListEndpointsByPlatformApplication Amazon SNS C#

我试图弄清楚如何使用AWS Simple Notification Service将通知发送给ios应用程序用户。

当我在Web应用程序中查看Application Endpoint时,我看到:

在此处输入图片说明

对于每个已注册的设备,我将在用户数据部分中存储我们唯一的userId。 然后,我将要发送如下推送:

public AmazonPushProvider(AmazonProviderObject provider)
{
            _client = new AmazonSimpleNotificationServiceClient(provider.AWSAccessKey, provider.AWSSecretKey);
            _appARN = provider.AppARN;
}

public void SendApplePush(string apsJson, int[] userIds = null)
{
    var iOSModel = _client.ListEndpointsByPlatformApplication(new ListEndpointsByPlatformApplicationRequest { PlatformApplicationArn = _appARN });


    foreach (var endpoint in iOSModel.Endpoints)
    {
        if (endpoint.???)
    }

}

问题是ListEndpointsByPlatformApplicationRequest似乎没有返回用户数据属性。 如何通过平台应用程序从端点列表中获取用户数据属性?

一旦有了平台端点ID,就可以调用GetEndpointAttributes()

它返回带有以下信息的响应:

Gets and sets the property Attributes.
Attributes include the following:
CustomUserData -- arbitrary user data to associate with the endpoint. Amazon SNS does not use this data. The data must be in UTF-8 format and less than 2KB.
Enabled -- flag that enables/disables delivery to the endpoint. Amazon SNS will set this to false when a notification service indicates to Amazon SNS that the endpoint is invalid. Users can set it back to true, typically after updating Token.
Token -- device token, also referred to as a registration id, for an app and mobile device. This is returned from the notification service when an app and mobile device are registered with the notification service.

暂无
暂无

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

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