We are trying to send push notification dynamically to all registered devices (android) using azure push notification. when we are trying to register the device using device token received from flutter mobile app. it is not getting registered.
For reference: https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-nodejs-push-notification-tutorial
In the above documentation, there is no step to register device using their device token to notification hub. So tried to check on some tech forums and got a sample way to proceed on registering device. Code is below for reference.
notificationHubService.gcm.createTemplateRegistration(
'replacing device token',
'tag', {
'aps': {
'alert': '$(message)',
'badge': '#(count)',
'sound': 'default'
}
},
function (e, r) {
if (e) {
console.log(e);
} else {
console.log({
id: r.RegistrationId,
deviceToken: r.DeviceToken,
expires: r.ExpirationTime
});
}
}
);
Response
{ id: '1294571364808236565-5460521645299605787-1', deviceToken: undefined, expires: '9999-12-31T23:59:59.999' }
device token is always returning as undefined.