我想在后台以本机方式接收到一个本地推送通知时遇到多次振动。怎么可能?
我尝试将https://github.com/zo0r/react-native-push-notification与以下代码一起用于无声推送通知:
PushNotification.localNotificationSchedule({
message: "This is one message with three vibrations",
playSound: true,
soundName: "silentSound.wav",
repeatType: "day",
date: new Date(time),
})
当然,我可以连续安排多个通知,但是那时我还会有多个消息。
答案 0 :(得分:0)
我明白了
import PushNotification from 'react-native-push-notification';
import { Vibration } from 'react-native';
export function notification(title, message, channelID = "fcm_fallback_notification_channel") {
Vibration.vibrate(10000, true);
PushNotification.localNotification({
channelID,
title,
message,
vibration: 10000,
});
}