First of all thank you for this plugin. As you wrote on readme it have problems with android Oreo...
The app crash with the sample code:
cordova.plugins.notification.local.schedule({
title: 'My first notification',
text: 'Thats pretty easy...',
foreground: true
});
simply use the code above onDeviceReady
make sure your plugin version is beta._3_ or later
beta .3 is working with AVD 8.1 but not with physical device 8.1: still having the same issue.
Debugging with android studio i found that the resId is loaded in getSmallIcon https://github.com/katzer/cordova-plugin-local-notifications/blob/06baff7674014d525238ae2b86f20ebf1622dda5/src/android/notification/Options.java#L379
It goes in the first if
statement trying to load the DEFAULT_ICON (that is unavailable) so it get the system resource and return a resId...
To prevent app crash you must define the smallIcon
into the notification object param. However if it doesen't find the resource it fallback to a system resource that cannot be accessed in android Oreo.
My pull seems to prevent this issue
I can confirm that beta .3 is NOT working on real Android 8.1 devices.
To prevent app crash you must define the
smallIcon
into the notification object param. However if it doesen't find the resource it fallback to a system resource that cannot be accessed in android Oreo.
Thank you
This works for me
This is how my code looks now:
const notification = {
id: 1234,
text: 'This is notification',
trigger: { at: new Date() },
led: 'FF0000',
smallIcon: 'res://mipmap-hdpi/ic_launcher.png',
icon: 'res://mipmap-hdpi/ic_launcher.png',
vibrate: true
};
this.localNotifications.schedule(notification);
res is a folder in android/app/src/main/res
Most helpful comment
To prevent app crash you must define the
smallIcon
into the notification object param. However if it doesen't find the resource it fallback to a system resource that cannot be accessed in android Oreo.My pull seems to prevent this issue