1

I'm using the parse4cn1 to enable push notifications for my cn1 app (with a hosted parse server called back4app). I want to add a custom icon for the notification tray in Android, and I need to add a line to the <application> section of the manifest.xml file:

<meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/push_icon"/>

Where do I put the png file within the cn1 project structure?

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
ygesher
  • 1,133
  • 12
  • 26
  • Codename One supports such icons in the native push as far as I recall. No idea about parse4cn1. Either way I added the tag to parse4cn1 so this will draw the right attention – Shai Almog Mar 21 '16 at 03:33
  • 1
    This is not a parse4cn1 question per se: It's an issue of where CN1 expects resources specified in the manifest to be placed in the folder hierarchy. I searched a bit online but couldn't find a clear answer. @ShaiAlmog: Can you provide a pointer? – netsuite_insights Mar 21 '16 at 11:46
  • PS: Adding the meta data tag should work using [build hint](http://www.codenameone.com/manual/advanced-topics.html) `android.xapplication` – netsuite_insights Mar 21 '16 at 11:46
  • Should have scrolled down to https://www.codenameone.com/manual/advanced-topics.html#build_hints_in_cn1libs you can just add the two files to the cn1lib. We discussed this in the blog too a while back https://www.codenameone.com/blog/deprecations-simplified-cn1lib-installs-theme-layering.html – Shai Almog Mar 22 '16 at 03:37
  • Sorry, Shai, I didn't understand your answer. I need the png file to be added to the res/drawable-xhdpi directory in the android source. Is there are a way to do this without just downloading the project's android source code and building myself? – ygesher Mar 26 '16 at 21:32
  • @ShaiAlmog Is there a solution for this issue? – ygesher Apr 05 '16 at 18:15
  • That's unrelated to us. We support our standard push notification API I have no idea what parse uses. – Shai Almog Apr 06 '16 at 02:55
  • @ShaiAlmog the original question is where to place a file within the project structure so that it will be placed in a drawables directory in the native Android project? – ygesher Apr 06 '16 at 05:24

2 Answers2

0

AFAIK this is currently unsupported but is probably something we should support as we do support it for sound files and XML files. I suggest filing an RFE in the issue tracker asking for this.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
0

The correct answer has already been posted here on SO by Hen Fishbein, one of the co-founders of CodenameOne, but for some reason it was very hard for me to find, so I'm reiterating it:

Put a file named ic_stat_notify.png in the src/ folder of the project. The icon should conform to the Android guidelines for such icons, as stipulated in the docs. The official recommendation is to add 5 differently-sized icons for the various screen density buckets, all of them being 24 dp, with a 22 dp area for the icon and 2 dp of padding. The CodenameOne project only allows one file, so I recommend making it 72 pixels, which corresponds to the xhdpi bucket.

Community
  • 1
  • 1
ygesher
  • 1,133
  • 12
  • 26