3

プッシュ通知を取得しようとするXamarinとAWS SNSの使用。先日、彼らはうまく働いていた。今日はそうではありません。AWS SNS Android GCM - InvalidPlatformToken

私はAndroidデバイスとiOSデバイスを持っています。私のアプリケーションで何かを変更するたびに、他のデバイスはプッシュ通知を受け取ることになっています。 iOSデバイスが動作しています。

Android上で加入するためのC#コード:そこにいくつかのブレークポイントを削除

[Service(Exported = false)] 
public class RegistrationIntentService : IntentService 
{ 
    static object locker = new object(); 

    public RegistrationIntentService() : base("RegistrationIntentService") { } 

    protected override void OnHandleIntent(Intent intent) 
    { 
     try 
     { 
      Log.Info("RegistrationIntentService", "Calling InstanceID.GetToken"); 
      lock (locker) 
      { 
       var instanceID = InstanceID.GetInstance(this); 
       var token = instanceID.GetToken(
        "shhh it's a secret.", GoogleCloudMessaging.InstanceIdScope, null); 

       Log.Info("RegistrationIntentService", "GCM Registration Token: " + token); 
       SendRegistrationToAppServer(token); 
       Subscribe(token); 
      } 
     } 
     catch (Exception e) 
     { 
      Log.Debug("RegistrationIntentService", "Failed to get a registration token"); 
      return; 
     } 
    } 

    void SendRegistrationToAppServer(string token) 
    { 
     // Add custom implementation here as needed. 
     //... handling my token on the back-end 
    } 

    void Subscribe(string token) 
    { 
     var pubSub = GcmPubSub.GetInstance(this); 
     pubSub.Subscribe(token, "/topics/global", null); 
    } 
} 

私は私のデバイストークンは、私がメッセージを送信しようとしているAWSエンドポイント用のトークンと一致しないことがわかります。しかし何らかの理由で、AWSからエラーメッセージが返ってきています。これは、AWSが私を送信しているものです:私は、アプリケーションから戻ってきてるトークンは私のAWSエンドポイントのトークンと一致して知っていれば

{"DeliveryAttempts":1,"EndpointArn":"arn:aws:sns:...:endpoint/GCM/...","EventType":"DeliveryFailure","FailureMessage":"Platform token associated with the endpoint is not valid","FailureType":"InvalidPlatformToken","MessageId":"...","Resource":"arn:aws:sns:...:app/GCM/...","Service":"SNS","Time":"2016-03-28T18:22:59.360Z"}

は何が原因だろうか?

+1

解決方法をお探しですか?私はまったく同じ問題にぶつかっています。 – thumper

答えて

関連する問題