Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 运行cordova本地通知”;“论触发”;应用程序关闭时的代码_Android_Cordova_Ionic Framework_Android Notifications_Localnotification - Fatal编程技术网

Android 运行cordova本地通知”;“论触发”;应用程序关闭时的代码

Android 运行cordova本地通知”;“论触发”;应用程序关闭时的代码,android,cordova,ionic-framework,android-notifications,localnotification,Android,Cordova,Ionic Framework,Android Notifications,Localnotification,我正在为Android开发一个应用程序,将文件备份到服务器。该应用程序每天检查一次新文件并将其复制到备份服务器。我正在使用Ionic和localnotifications cordova插件,配置每日通知和对触发事件的订阅,以启动检查和备份过程。 如果应用程序位于前台或后台,它可以正常工作,但如果应用程序关闭/终止,则会显示通知,但不会执行“on trigger”事件订阅中的代码 例如: this.localNotifications.on("trigger").subscr

我正在为Android开发一个应用程序,将文件备份到服务器。该应用程序每天检查一次新文件并将其复制到备份服务器。我正在使用Ionic和localnotifications cordova插件,配置每日通知和对触发事件的订阅,以启动检查和备份过程。 如果应用程序位于前台或后台,它可以正常工作,但如果应用程序关闭/终止,则会显示通知,但不会执行“on trigger”事件订阅中的代码

例如:

this.localNotifications.on("trigger").subscribe( n =>{
    //This is the code that is executed if the app is in foreground or 
    background, but not if it's closed, even if the scheduled alarm is 
    triggered
})
这是因为应用程序已关闭且无法执行任何代码而按预期工作,还是一个bug?有什么解决办法吗?我不想让应用程序一直打开,即使是在后台

Cordova localnotifications插件版本:0.9.0-beta.3 平台:安卓 Cordova版本10.0.0 Cordova平台版本:android 9.1.0 Ionic版本:CLI 6.13.1,框架:@Ionic/angular 5.5.4

多谢各位