0
votes

I would like to have multiple vibrations on receiving one local push notification in background in react-native. How is it possible?

I tried using https://github.com/zo0r/react-native-push-notification with the following code for a silent push notification:

  PushNotification.localNotificationSchedule({
    message: "This is one message with three vibrations",
    playSound: true,
    soundName: "silentSound.wav",
    repeatType: "day",
    date: new Date(time),
  })

Sure, I could schedule multiple notifications in a row, but then I would have also multiple messages.

1

1 Answers

0
votes

I got it

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,
  });
}