How to put android/cordova resource file to Outsystems 10 Mobile apps?

How to put android/cordova resource file to Outsystems 10 Mobile apps?

  

Hi, I'm currently exploring OneSignal Push Notification Plugin, and I want to use custom notification icon.

Currently it only showing default white bell icon.


On OneSignal documentation found here: https://documentation.onesignal.com/docs/customize-notification-icons

I need to put icon png to these android resource folder, and name icon file accordingly...

I notice in Outsystems 10 Mobile Apps, there is Images on Interface tab, and Resources on Data tab. 

I tried to put ic_stat_onesignal_default.png on Images, but I can't set folder needed.

I also tried to put ic_stat_onesignal_default.png on Resources, and set Deploy Action to Target Directory drawable-hdpi etc, but still failed to display correct notification icon.

The resource files should be downloaded on Splash Screen right?

How do I put android/cordova resource file correctly?

Thanks.


Hello Harlin.

This is not straightforward as it is a very particular extensibility scenario. As of today, to do what you want, you'll have to either "fork" the original OneSignal plugin on GitHub or create a new cordova plugin to copy the files. In either case, you need to create a hook in the plugin (the "forked" or a new one) to copy the images to the specific folder. Here's a simple example: resources_copier. This is just an example, it does not do exactly what you're trying to achieve.

Also, this example does not have the plugin.xml, you need to add it and declare the hook (section "Ways to define hooks"):

<hook type="before_prepare" src="resources_copier.js"/>


Note that according to the documentation you shared, "iOS doesn't support custom icons, as it uses the app icon for all notifications." That means your app will have different behavior on iOS and Android.


Let me know if you need any further assistance.

Thanks

Hi Harlin,


I saw documentation and I guess the api support an url too. Not only the resource.

So you can try put into the image folder. this image will be accessible from http://server/project/img/

Then call api using this url for icons


Regards

Fabio


Hi César Afonso,

Can I just put those icons to res folder inside generated apk? (which is a zip file) 


Hi Fabio, 

For large icon on notification window yes it can accept url.

But for small icon on status bar, it only accept resource name.


Thanks for your amazing fast response...