I have an old app developed with Appcelerator - Titanium SDK using FCM Push notifications.
The device token that I get on the device is:
"baf48325219887fdb5929ac5d9495d8897a48f0b77a1c9c23131097e51dc1234"
Because Appcelerator is deprecated, I want to know how to get the FCM token so I can still notify the devices even if Appcelerator has been deprecated.
** UPDATE **
This is the code for getting the deviceToken:
exports.requestDeviceToken = function() {
if (Ti.Platform.model.indexOf('Simulator') !== -1 || Ti.Platform.model.indexOf('Emulator') !== -1) {
return;
}
var params = {
callback:pushNotificationCallback,
success:deviceTokenSuccess,
error: deviceTokenError,
};
var types = [
Ti.Network.NOTIFICATION_TYPE_BADGE,
Ti.Network.NOTIFICATION_TYPE_ALERT,
Ti.Network.NOTIFICATION_TYPE_SOUND
];
if (Ti.Platform.name == 'android') {
var CloudPush = require('ti.cloudpush');
// Initialize the module
CloudPush.retrieveDeviceToken({
success: deviceTokenSuccess,
error: deviceTokenError,
});
CloudPush.addEventListener('callback', pushNotificationCallback);
}
else {
if (Ti.Platform.name != "android" && parseInt(Ti.Platform.version.split(".")[0]) >= 8) {
Ti.API.info('registering push notifications iOS > 8');
Ti.Network.registerForPushNotifications(params);
Ti.App.iOS.registerUserNotificationSettings({types:types});
}
else {
params.types = types;
Ti.Network.registerForPushNotifications(params);
}
}
};
Any clue?