PushNotification // How to safe received token?


#1

I don´t know how to save my tokens. I tried to do it like that: push.saveToken(data.registrationId,{ignore_user:true}); but it throws a error.

My Code:

var push = PushNotification.init({
	ios: {
		alert: true,
		badge: true,
		sound: true
	}
});

push.on('registration', function(data) {
	console.log('registration');

	push.saveToken(data.registrationId,{ignore_user:true});
	console.log(data.registrationId);
});

push.on('notification', function(data) {
	console.log(data.message);
	console.log(data.title);
	console.log(data.count);
	console.log(data.sound);
	console.log(data.image);
	console.log(data.additionalData);

	alert('notification');
});

push.on('error', function(e)	 {
	console.log(e.message	);
	alert('error'	);
});

Thank you for your help!