问题描述
我的移动应用程序正在运行,并且在Play商店和App Store上都在线,唯一的问题是,当收到推送通知时,我无法使移动设备振动。
我设法解决了该应用程序在打开和运行时的问题,当收到一条消息时会调用onMessage的原因,所以我告诉手机在回调中振动。
import {Alert,Vibration} from 'react-native';
import messaging from '@react-native-firebase/messaging';
messaging().onMessage(async (remoteMessage) => {
console.log('onMessage',remoteMessage);
Alert.alert(
remoteMessage.notification.title,remoteMessage.notification.body,);
Vibration.vibrate();
});
即使最小化或关闭应用程序,即使在setBackgroundMessageHandler
方法内,我仍然无法使手机振动。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)