iOS push tokens
When you send an iOS push notification to an invalid token, Mixpanel takes different actions depending on the error returned:
410 response of expired topic: The invalid token will remain in $ios_devices on that profile, but the push notification will not be delivered.
For invalid APNS responses where there is a mismatch of token and the certificate in your Mixpanel project or simply an improperly formatted token: Mixpanel removes the invalid device token from the $ios_devices property on that profile.
Consequently, iOS push notifications are only delivered to tokens that are valid to your certificate and valid in the current topic. Those that are not a token mismatch or improperly formatted token but that still do not meet those qualifications effectively fail silently and remain on your profiles. Attempting to deliver to invalid tokens does not impact the deliverability to valid tokens. However, each attempt to deliver to an invalid token will appear as a sent push Notification in Mixpanel - for example, if you sent a push notification to 20 iOS device tokens but five were invalid, Mixpanel will still show that you sent 20 push notifications.
Remove inactive iOS push tokens
Calling the $remove method (listed under the Update Operations section) will remove specific tokens from your Mixpanel People profiles. This will be reflected in the "iOS Devices" list property of APNs push tokens:
- Check the feedback service for tokens that are invalid for the current topic.
- Remove them from your server.
- Use the $remove method (listed under the Update Operations section) to remove the invalid tokens from the respective profiles.
You can find more details about unsetting people properties and re-appending items to list people properties in our Engage API documentation.
Android push tokens
On Android, if you try to send a push notification, Google responds with a status code; Mixpanel will take different actions depending on the status returned:
MismatchSenderId: This error means you used one project ID to generate the device token and another project’s API key to send the push. To remedy this, you need to be sure that the project ID and API key match in the Google Developer Console. In the case of this error, Mixpanel will not remove the token from the $android_devices property.
canonical_ids: This error means you have previously registered this device with GCM, but have sent the current push with a duplicated push token. Mixpanel will remove the duplicated token and add the master canonical ID from GCM back to the device token list. This issue commonly occurs in testing when you uninstall and reinstall the app multiple times, generating a duplicated token on each new install.
For all other errors besides MismatchSenderId and canonical_ids: Mixpanel will remove the invalid device token from the list of device tokens in the $android_devices property on that profile.
If you are investigating Android push issues, look for the “Android Push Error” property on a user’s profile, which will log the corresponding error code from GCM and allow you to debug the issue in detail:
Remove inactive Android push tokens
Unlike iOS, inactive Android push tokens are removed automatically, so there is no need to go through a process of manually removing them.