Use vibration when the application is running in the background

Viewed 531

I have a function that starts at the beginning of the application and listens when a notification appears

messaging().setBackgroundMessageHandler(async remoteMessage => {
  Vibration.vibrate(1000)
  console.log('Message handled in the background!', remoteMessage);
});

Inside, I caused a vibration

When the application is turned on, the vibration works correctly

When the application runs in the background, there is no vibration at all

Is there a way for it to work?

1 Answers

The vibration when your app is in the background depends on the settings of your phone and not of the app. For instance if you have an iPhone, settings -> sounds & Haptics you will find:

iphone

Related