Search code examples
ioscordovaapple-push-notificationsphonegap-pluginsamazon-sns

FCM iOS device token not working in aws sns push notification


I created an application in aws sns for Apple Development, used p12 file for credentials. I'm using cordova app with phone-gap.

Formats:

# device token format
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

# registration id format
abCDEFghijk:AHJGJkhkhkbjkJYJgjkhkjhkjhkkhkhkhkhkjhkGSDH6gjhgHGugkjhgjgGjhgjhghJGjhhj-98jhgjhf-tIE_&jhgfhfjhgjhggfgdhfjhkhlhljxvcxbbm-QjhghGuuhfdgfhjmgjjkg

# In aws Examples: this is the format of device token they are getting

59b70e15ca0f24835b49471e74a9a4095ed3d93bd4642c350c33b309d0b29f5b

When I tried to create endpoint application using the above device token I'm getting following error:

Invalid parameter:
  Token Reason: iOS device tokens must be no more than 400 hexadecimal characters
  (Service: AmazonSNS;
   Status Code: 400;
   Error Code: InvalidParameter;
   Request ID: 14a9e207-9d0d-55b7-8394-b1ec0eabd59b)

I checked with aws documentation and they have different device token documentations: check this link.

What am i missing??

Is there a way to convert the token in correct format in c#?


Solution

  • I fixed this issue by using APNS for iOS. I was trying to register FCM generated device token into APNS. Once I changed it, I started to get device token in required format.