I've managed to push notifications successfully whenever the real-time database changes through FCM, and ultimately through the Firebase Cloud Functions
But I do so by setting a constant with the device token hard-coded in:
const registrationToken = "yuYF4yF3nkj....."
and then adding it when I fire the notification
return admin.messaging().sendToDevice(registrationToken, payload, options);
I've also tried to use context.instanceIdToken;within:
exports.pushNotification = functions.database .ref("....") .onWrite((change, context) => {
const TokenID = context.instanceIdToken;
console.log(TokenID);
But it prints out: "undefined"
How can I read my device's token instead of hard-coding it in, since if I were to share this application I would assume the token for each device would be different.