Hi Gang,
I’m using the cordova-plugin-local-notifications plug-in in my app, along with a custom icon. To implement this, I have the following:
Code to schedule the notification:
this.localNotifications.schedule({
id: id || mode,
title: 'Reminder from Pure North',
text: `Remember to track your ${TrackingModes[mode]}`,
firstAt : dateTime.toDate(),
every: 'day',
icon: 'notification',
led: '0000FF'
});
Hook to copy the notification icon from:
resources\other\android\res\drawable-*
to:
platforms\android\res\drawable-*
during the build process
The hook code can be viewed here:
Locally this all works. If I run “ionic build android” and inspect the .apk, the custom icons are where they are supposed to be. If I install the.apk everything looks great. Unfortunately, if I run “ionic package build android” and inspect the resulting .apk, the custom icons are nowhere to be found. My guess is an issue with the hook.
Looking at the docs for Ionic Package, it appears that custom hooks are not supported. The documentation links to a repository of common hooks, however the hook to handle custom resources appears to be broken.
Has anyone has any success using “ionic package build” with custom resources, and having the resources end up in the res/drawable-* folders in the .apk? Is there an alternative approach?
Thanks!