Open ms88privat opened 8 years ago
I got this to work by sending the device token manually to the mixpanel api.
console.log('TOKEN:', token);
let params = {
'$distinct_id': 'xxx',
'$token': 'apiTokenMixpanel',
'$union': {},
};
if(Platform.OS === 'ios') {
params['$union']['$ios_devices'] = [token.token];
} else {
params['$union']['$android_devices'] = [token.token];
}
const query = {
data: base64.encode(JSON.stringify(params)),
};
GET Request to http://api.mixpanel.com/engage?data=...
PS: To get the Notfication to show up on Android devices you need to specify extra data fields in mixpanel. E.g.
{
"data": {
"title" : "TitleOfNotification"
},
"message": "hello"
}
simple way if you're doing iOS, mixpanel shared instance can be accessed from AppDelegate too :
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
Mixpanel *mixpanel = [Mixpanel sharedInstance];
[mixpanel.people addPushDeviceToken:deviceToken];
[RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
is that still available?
Would be awesome if somebody could implement addPushDeviceToken 👍
I think this is an essential feature of mixpanel.