katzer / cordova-plugin-local-notifications

Cordova Local-Notification Plugin
Apache License 2.0
2.56k stars 1.74k forks source link

Local Notifications Trigger events Not working on Android 12 #1989

Open bevinGithub opened 1 year ago

bevinGithub commented 1 year ago

WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!

Provide a general summary of the issue. I have Local Notifications 12 plugin and l want to subscribe to events when the notification triggers. I want to subscribe to event Trigger but the plugin is not subscribing to any events.

Your Environment

I have the following environment setup. Ionic:

Ionic CLI : 6.20.1 (C:\Users\Tigere Bervin\AppData\Roaming\npm\node_modules@ionic\cli) Ionic Framework : @ionic/angular 6.2.8 @angular-devkit/build-angular : 14.2.3 @angular-devkit/schematics : 14.2.3 @angular/cli : 14.2.3 @ionic/angular-toolkit : 6.1.0

Cordova:

Cordova CLI : 11.0.0 Cordova Platforms : android 10.1.2 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 7 other plugins)

Utility:

cordova-res : 0.15.4 native-run : 1.7.1

System:

NodeJS : v14.15.4 (C:\Program Files\nodejs\node.exe) npm : 6.14.10 OS : Windows 10

C:\ionicAndroid12\prosperclocknew>cordova plugin list cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter" cordova-plugin-androidx 3.0.0 "cordova-plugin-androidx" cordova-plugin-badge 0.8.8 "Badge" cordova-plugin-device 2.0.2 "Device" cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard" cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview" cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar"

Expected Behavior

When the notification triggers we should be able to subscribe to events like Trigger or onCLick

Actual Behavior

When the notification triggers nothing is subscribed to meaning no events are subscribe to plugin ignores the subscribe section

Steps to Reproduce

Reproduce this issue; include code to reproduce, if relevant

Local Notifications crashes the app, l have troubleshoot the issue and the problem is on the trigger any configurations the app is crashing. The settings below works on platform 10.0.0 works very well but we cannot publish with Platform Level 10.0.0

this.localNotifications.schedule({ id: 1, text: 'Single LocalNotification', trigger: {every: { weekday: 1, hour: 11, minute: 31 }, count: 1} });

this.localNotifications.schedule({ id: 1, text: 'Single LocalNotification', trigger: {at: new Date(new Date().getTime() + 3600)}, });

I have tested the plugin katzer / cordova-plugin-local-notifications it doesnt work on the events onTrigger

onDeviceReady() { this.localNotifications.on('trigger').subscribe((test: any) => { console.log('Trigger' + JSON.stringify(test)); }); }

Its not logging the subscription out as l need to process data from the data: { test: 'Test Data }.

Context

What were you trying to do?

Play custom audio files when the alarms is triggered onTrigger event

bevinGithub commented 1 year ago

Anyone has managed to resolve the Local Notifications subscription event onTrigger on android 12 onDeviceReady() { this.localNotifications.on('trigger').subscribe((test: any) => { console.log('Trigger' + JSON.stringify(test)); }); }