Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify if device token is for android or iOS?

I store Android and iOS device tokens in DB. Following are few examples of device tokens getting saved in the DB.

  • 359092050465370
  • 654C4DB3-3F68-4969-8ED2-80EA16B46EB0
  • 294913EC-6100-42E8-8C2D-E9F68F286ADE

How to differentiate whether a particular device token is for an Android or iOS device?

like image 649
user3035658 Avatar asked Nov 26 '13 09:11

user3035658


People also ask

Is device token unique 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.


2 Answers

I recommend that you send additional information along with the token to the server. For example, information about what type of device the token was registered from, i.e. Android or iOS. A suitable solution is the setup a REST service for registering your tokens. If you implement this solution, you are future proof with regards to future changes in Android/iOS token length. Other useful information to store is the user id or similar.

I assume that you do are talking about your own DB where you store the tokens.

like image 106
Johan Karlsson Avatar answered Sep 22 '22 18:09

Johan Karlsson


Iphone Device token

The device token is 32 bytes binary form, means 32 degits for iphone and 15 for android

like image 31
Shyantanu Avatar answered Sep 22 '22 18:09

Shyantanu