Local Notifications Crushing the Ionic Angular App (Cordova)

I have created a new ionic Cordova angular app trying to test the Android 11 upgrade. The local notifications plugin is working if l add platform 10.0.0 SDK Target 30 which you are not able to publish a new app on google playstore.

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”

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

  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)},
  });

What do l need to do to make the upgrade work so that l can publish my new app. Your assistance will be much appreciated

There have been a lot of changes on SDK 31 that break push notifications, the plugin should be updated to address some changes, but doesn’t look like it’s maintained anymore, so somebody will need to fork the plugin, fix the problems and publish the fork.

Thank you very much for the feedback, so in short there is no indication or plans on the plugin upgrade ?

I don’t know the plugin author, but last update was almost 3 years ago, so I don’t think they plan to update the plugin anymore.

Hi Julio, l found out from the another fellow developer that there is a version 12 from the author it’s just the version 12 is not explicitly mentioned on the site.

ionic cordova plugin add cordova-plugin-local-notification-12

is the latest one for Android 12 l have installed it and the notifications is working just need to check on my custom sound as its not playing the sound.

It’s not from the same author, there seem to be two forks with the Android 12 fix, cordova-plugin-local-notification-12 and cordova-plugin-local-notification-android-12-fix

I will will have to test both plugins and see which one works better, thanks for all the feedback.

Hi Julio. the plugin has a bug it does not log the events if you add on Trigger event. I have tested it on different versions.

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

need same for android 13