Mas*_*oki 7 android flutter firebase-cloud-messaging
我想在发送 FCM 通知后唤醒设备。我能够使用 Cloud Functions 中的 admin sdk 向 Android 设备发送通知。但是,我无法在锁定时唤醒设备(仅发出声音)。其他应用程序(例如 Gmai)可以唤醒设备。此外,它在 iOS 上运行良好。
以下是云函数中的代码。
try {
const options = {
priority: "high",
};
const payload: admin.messaging.MessagingPayload = {
notification: {
title: message.title,
body: message.body,
click_action: 'FLUTTER_NOTIFICATION_CLICK',
badge: `${message.badgeNum}`,
},
};
await admin.messaging().sendToDevice(message.fcmToken, payload, options);
} catch (e) {
console.error(e.message);
throw e;
}
Run Code Online (Sandbox Code Playgroud)