Open kamranarshad opened 7 years ago
You mean when receiving a push notification? Not sure from the top of my head, but do you have all the icons in your app_resources folder?
Yes, I do mean when receiving a push notification.
I do have the default icon in the app_resources/android folder.
Hmm, just tested on an Android 4.4 emulator with a freshly generated starter app and the icon shows up correctly in the tray as well as in the notification center (pull down from the top, the icon is bigger there).
Did you replace the default icon by a custom one which may have render issues?
I am using the default icon provided when you run tns create appName
Me 2. What device is this, and what about others?
I have only tested on my device Nexus 6P, I couldn't seem to get push notification working on android emulator, but will try again tomorrow.
Ok. I used a genymotion image with play services installed.
I have play services installed in the include.gradle
file and I have used a different icon, both don't seem to display an icon in the notification.
Let me try that again:
I have tested on android emulator on android 6.0 and google play service pack.
So you've tested on the same Android version in Genymotion as I did, with the demo app and the default icons?
I haven't tested on Genymotion, only on standard android emulator you get with android studio
OK so previously you said "I have only tested on my device Nexus 6P" - did you or did you not test on a real device? And if not please do so and check if the icon is OK..
I have checked on real device and on standard android emulator but not Genymotion.
Ah OK, that took us 20 messages to figure out, lol 😄
Did you test those devices with the default {N} icons, or your own? In case of the latter: can I have them?
I have tested with the default icon, I did use an icon from google images and that didn't seem to work to.
Are you building with the NativeScript CLI, or Telerik Platform?
It seems that the Android launcher icon is problematic as confirmed by the Firebase team in this issue.
I am using the NativeScript CLI.
Hello! The default icon from the assets folders worked for me with notifications in the Android status bar, but it seems like as of android 3.0, these require a specialized icon that is only white on a transparent background: https://stuff.mit.edu/afs/sipb/project/android/docs/guide/practices/ui_guidelines/icon_design_status_bar.html
This icon then gets put to a drawable folder for that specific platform version (ie. drawable-xhdpi-v11), but it should also be specified with its own name.
Here is some info on setting the notification specific icon on a Cordova Firebase plugin in the Android Manifest. Any idea how this could be done with this plugin? https://github.com/arnesson/cordova-plugin-firebase/issues/53
So I was able to generate the simple icon one colour icon used in newer Android versions and then specify it in the message body. Is there a way to set a default icon through the plugin of Android manifest?
Anyone figured out yet how to provide these icons? (With or without help of the plugin) I'm struggling with this too.
This is actually described in the Google Firebase documentation. I think this ticket can be closed.
Hey @mn-martin the simple one colour icons have to be added in the android drawable assets folder and then the icon to be displayed specified as part of the push notification payload, ie.:
curl -X POST --header "Authorization: key=<auth key>" --Header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{\"notification\":{\"title\": \"My title\", \"text\": \"My text\", \"sound\": \"default\", \"badge\": \”1\", \"icon\": \"ic_stat_announcement\"}, \"data\":{\"messageId\": \"313967\"}, \"priority\": \"High\", \"to\": \”<firebase device token>\”}"
Thank you @thomasmoon this will be helpful if I need a special icon / message. Nice to have a resource for that issue now as well :-) 👍
I'm new to app development, can some summarize how to change default status bar icon of the app. I've created my white and transparent images and placed them in
app/App_Resources/Android/src/main/res/drawable-ldpi/status_icon.png
app/App_Resources/Android/src/main/res/drawable-mdpi/status_icon.png
app/App_Resources/Android/src/main/res/drawable-hdpi/status_icon.png
...
My app/App_Resources/Android/src/AndroidManifest.xml
file looks like this
<manifest>
<application>
<service android:name="org.nativescript.plugins.firebase.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<service android:name="org.nativescript.plugins.firebase.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/status_icon" />
</application>
</manifest>
But its not working. What am I missing?
I cannot get it working - just get white square. I have read tt it might be due reason that icon does not fit requriements but i did generate icons using https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=clipart&source.clipart=ac_unit&source.space.trim=1&source.space.pad=0&name=ic_stat_ac_unit Anybody solved that?
The icon should be white in color with transparent background. Are you setting a custom color either from notification / in manifest?
No, that's the thing. Icon is white with transparent background and I do not v set custom color. Icon is exactly as in the link
I'm pretty sure the plugin works, it does on my end. Hence you have already created a SO thread, I suggest we discuss there.
Maybe you can download that icon and check if it works with that icon?
I have made simple icon just put there white dot and it worked. My guess is that the should not be any transparent dots on icon just white 100% opacity or none? Because icon generator made aliasing does to make icon more smooth?
If yes - how to generate nice icon from logo?
I generally turn the logo into white and background to transparent, it worked almost every time. You may share the icon if you still have the issue.
@manojdcoder have you had a chance to look / try the icon?
It started to work after i removed android folder undel platforms and rebuild whole solution
Is there any way to set an icon for android. I only get a blank icon.