Я отправляю уведомление с помощью сообщений Firebase. Когда я отправляю уведомление, оно не будет отображаться в мобильном телефоне. Но я вижу журнал в консоли.
Вот мой индекс. js:
'use strict'
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.sendNotification = functions.database.ref('Notification/{notification_id}/{token}')
.onWrite((data, context) =>
{
const token_id = "cPA9XJx7-jU:APA91bGW5WS5q-TL8Q_cZaKYdiyjMDwdNlagieGXW99hLmRJG8BEw7Ao_Q4VzjcDwu4fWh1imyzi6g_tH9vOiyKefzjwTxvaI3HSppDvW5MJWLBTKp_Vw42IslaEpTSj6lTnPa9gGmgg";
const payload =
{
notification:
{
title: "Test Notification",
body: `Hello, this is test.`,
icon: "default"
}
};
return admin.messaging().sendToDevice(token_id, payload)
.then(result =>
{
console.log('This was a notification feature.');
return null;
});
});
Это мой журнал консоли:
console