Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon SNS ios device token length

I have an iPhone app I'm working on and trying to get Amazon SNS set up to test PNS. When we register the app with APNS, it gives a 32-digit device token (873DBDDA-17CF-4A24-88C6-990B90AFC4C3). When registering a device with Amazon SNS, it says the device token must be 64-digits long. What am I missing here?

like image 566
Brad Herman Avatar asked Jan 03 '14 22:01

Brad Herman


People also ask

What is mobile device token?

A device token is not a device IMEI but an ID to identify a certain mobile app on a certain device. It is issued by calling libraries of FCM, JPush, or APNs. For JPush, an equivalent of a device ID is a registration ID in the aspect of its usage in the Kii Cloud environment.

What is device token in push notification?

Push token (device token) - is a unique key for the app-device combination which is issued by the Apple or Google push notification gateways. It allows gateways and push notification providers to route messages and ensure the notification is delivered only to the unique app-device combination for which it is intended.

How do I check my device token?

Sending a test Android push notificationClick on Settings and open Mobile Apps. Click on the Android App and make sure the Firebase API key has been configured. Click on Test Push and enter the device token for your test device. Add a test payload and send the test.

What is the format of structured notification messages sent by Amazon SNS?

The notification message sent by Amazon SNS for deliveries over HTTP, HTTPS, Email-JSON and SQS transport protocols will consist of a simple JSON object, which will include the following information: MessageId: A Universally Unique Identifier, unique for each notification published.


1 Answers

How did you get that token? It doesn't look like a correct APNS device token. A real one will be 64 hex digits. Here's the code I use:

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    NSString *tokenstring = [[[deviceToken description]
                              stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]]
                             stringByReplacingOccurrencesOfString:@" " withString:@""];

    // pass tokenstring to your APNS server
}

The token that I get out of that method looks like this:

 8ec3bba7de23cda5e8a2726c081be79204faede67529e617b625c984d61cf5c1
like image 130
jsd Avatar answered Nov 11 '22 09:11

jsd