In my app I have different devices registered and for the Android ones I am storing the GCM Registration Id and for the iOS I am storing the device token (push notifications).
I want to distinguish when a device is iOS or Android. What is the easiest way to do it? Do Android GCM RegIds start always with string "APA"?
In short no.
If you need to distinguish between Android and iOS clients, include a platform identifier (eg: platform: Android) along with the InstanceID token when sending it to your server. This way on your server you can know which clients are on which platform.
You should not depend on the format of the InstanceId tokens to determine device platform.
来源:https://stackoverflow.com/questions/33355586/do-android-gcm-registration-ids-always-start-with-apa