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?
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.
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.
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.
The Android device token is way longer than iOS device token.
I got 152 characters in the Android. While 64 total in iOS
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With