2015-09-29 2 views
0

Я не уверен, почему я не могу получить уведомление от AmazonSNS. Я что-то пропустил в своем коде? Кстати, я использую последнюю версию AWSSDK для Windows Store App.Не получать уведомления от AmazonSNS

Вот мой код.

d("init AmazonSimpleNotificationServiceClient"); 
AmazonSimpleNotificationServiceClient sns = new AmazonSimpleNotificationServiceClient("secret", "secret", RegionEndpoint.EUWest1); 

d("get notification channel uri"); 
string channel = string.Empty; 
var channelOperation = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); 
channelOperation.PushNotificationReceived += ChannelOperation_PushNotificationReceived; 

d("creating platform endpoint request"); 
CreatePlatformEndpointRequest epReq = new CreatePlatformEndpointRequest(); 
epReq.PlatformApplicationArn = "arn:aws:sns:eu-west-1:X413XXXX310X:app/WNS/Device"; 
d("token: " + channelOperation.Uri.ToString()); 
epReq.Token = channelOperation.Uri.ToString(); 

d("creat plateform endpoint"); 
CreatePlatformEndpointResponse epRes = await sns.CreatePlatformEndpointAsync(epReq); 

d("endpoint arn: " + epRes.EndpointArn); 

d("subscribe to topic"); 
SubscribeResponse subsResp = await sns.SubscribeAsync(new SubscribeRequest() 
{ 
    TopicArn = "arn:aws:sns:eu-west-1:X413XXXX310X:Topic", 
    Protocol = "application", 
    Endpoint = epRes.EndpointArn 
}); 

private void ChannelOperation_PushNotificationReceived(Windows.Networking.PushNotifications.PushNotificationChannel sender, Windows.Networking.PushNotifications.PushNotificationReceivedEventArgs args) 
{ 
    Debug.WriteLine("receiving something"); 
} 
+0

в вашем коде вместо этого вы вводите секретный секретный секретный секретный ключ амазонки? –

+0

, конечно, нет :) У меня есть настоящий секретный ключ. – jaysonragasa

ответ

0

это на самом деле работает после включения Тост на .appxmanifest

Я получаю уведомление каждый раз, когда я опубликовать RAW сообщение от Amazon SNS консоли. Я не получаю JSON, хотя я действительно нуждаюсь.

Смежные вопросы