Push notifications enable you to deliver personalized content to your users. You can use deep links to direct users to specific pages in your app, and measure reattributions.
- The push token is a unique identifier that can be used to sort Audiences and client callbacks.
- Push tokens are also required for uninstall and reinstall measurement.
How it works
Each device generates a unique push token that’s used to target it. The push token is sent to Adjust when the following information is passed to the MobileCore.track API:
ADJAdobeAdjustActionSetPushToken: a string constant that maps to thesetPushTokenmethod.data: a dictionary of values used to configure your push token.
When you call MobileCore.track with these arguments, the Adjust extension the token to the setPushToken method and sends the information to Adjust.
Reference
The data dictionary holds information about an action. To configure your push token, add the following key-value pair to your dictionary.
ADJAdobeAdjustPushToken-
The device’s push token.
Example: Send a push token
To send a push token to Adjust, you need to add a function to your main activity. In this tutorial, you’ll build on your ViewController from the integration guide and send an updated push token to Adjust. The final result looks like this:
Here’s what you need to do:
- Inside your
viewDidLoadfunction block, create a new dictionary calleddataDict. This is used to hold the properties of the action.
- Add your push token to the dictionary using the
ADJAdobeAdjustPushTokenkey. This example sets the push token to"de18dbf8-f38a-4962-8f1e-44abcf43055d".
- Finally, call
MobileCore.trackActionwithADJAdobeAdjustActionSetPushTokenand yourdataDictdictionary to send the push token to Adjust. If you’re using Objective-C, callremoveAllObjectson yourdataDictdictionary to deallocate it.
That’s it! Your push token is sent to Adjust when the view loads.