Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What length is iOS and Androids device token

Tags:

I need to save my users iOS and Android device token into a mySql DB so that I can send out push notifications.

My question now is what length is the device token for iOS and Android, is a column varchar(64) enough for a token?

like image 461
user2722667 Avatar asked Mar 23 '15 16:03

user2722667


People also ask

What is device token in iOS?

A device token is an identifier for the Apple Push Notification System for iOS devices. Apple assigns a Device Token on a per-app basis (iOS 7 and later) which is used as a unique identifier for sending push notifications.

What is device token in android?

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.

Is device token unique in Android?

The Device Tokens are NOT unique to the phone-app pairing. They are unique to the phone only. If you have multiple apps with push on the same phone they will all use the same Device Token. The certificate you use to send the notification will dictate which app it goes to.


2 Answers

The Android device token is way longer than iOS device token.

I got 152 characters in the Android. While 64 total in iOS

like image 127
Scar Avatar answered Oct 01 '22 03:10

Scar


As others have mentioned, I wouldn't rely on the length of the token to differentiate the two. Just a quick look in a large database showed me that there are iOS and Android devices that can have tokens of 152 or 174 characters.

You will want to rely on something else to differentiate them.

like image 35
Théo Blochet Avatar answered Oct 01 '22 02:10

Théo Blochet