我正在使用 firebase and react-native push notification
。我可以在应用运行或关闭时从 Firebase 收到通知。
我正在尝试发送从应用程序发送的本地通知,例如提醒
我的包裹
import firebase from '@react-native-firebase/app';
import '@react-native-firebase/messaging';
import PushNotification from 'react-native-push-notification';
发送
PushNotification.localNotification({
/* Android Only Properties */
channelId: '199720299',
title:'Tilltt',
message: 'YYYYYY',
data: 'dataa',
});
我所做的是安装后台计时器并在App.js componentdidmount
BackgroundTimer.setInterval(() => {
// this will be executed every 200 ms
this.showNotification22()
console.log('tic');
//timer will be calculated
}, 24100);
我只需要在应用关闭时调用此 this.showNotification22()
。我怎样才能做到。谢谢
只需要在周期内调用函数或执行任务即可。 请问有人做过吗?