[TIMOB-15570] Add support for largeIcon in Titanium.Android.Notification
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-07-29T23:26:37.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.0.0 |
Components | Android |
Labels | android, icon, notification |
Reporter | Mostafizur Rahman |
Assignee | Ashraf Abu |
Created | 2013-10-24T02:15:46.000+0000 |
Updated | 2015-08-24T21:26:05.000+0000 |
Description
Currently Titanium.Android.Notification (http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Android.Notification) only accepts one icon which is used for both the icon on the status bar and the icon displayed on the notification center.
Please add support for the largeIcon (http://developer.android.com/reference/android/app/Notification.html#largeIcon) so it becomes possible to have 2 different icons between the status bar and the notification center.
Many thanks
Hi, Is this issue resolved on the latest versions of Titanium? i want to add custom image to large icon on ACS notification. please help.
With Lollipop, I think this is going to be critical. If you want to follow google's iconography styles, you must provide your small icon in all-white. But when the user expands the notification tray in lollipop, notifications are shown on a (nearly) white background, leaving your icon almost invisible. If we can only specify one icon, the only thing we can do is to use a non-white icon, which would violate google's design standards here: http://developer.android.com/design/style/iconography.html Ideally, we'd have an all-white small icon, with a non-transparent, colored icon for the tray.
+1 for critical for Lollipop. Whats the reason for this having a low priority.
Another issue with icons in Lollipop. Sometimes my push notification icons are zoomed in and cropped when they are displayed in the in the status bar.
Jason I believe thats a different issue and can be resolved by providing the right icon sizes in the right folder in the project. The largeIcon issue above requires an SDK change.
Angus, can you elaborate? All I know to do is to put the notification icon into platform/android/drawable/res/foo.png and then reference it in the payload as icon => "foo". I haven't seen specs on the size to use. I paid close attention to some notifications this morning, and the problem occurs when the push notification first comes in -- android displays it at the top of the screen with a zoomed-in, cropped icon. That display auto-dismisses after a few seconds. Then I see the notification icon in the status bar, and it is sized correctly. Screenshots: Initial appearance: !http://s17.postimg.org/v36k0bk27/ss1.png! Status bar appearance: !http://s13.postimg.org/an8muebon/ss2.png! notifications tray appearance: !http://s7.postimg.org/es798f9hn/ss3.png!
Ah I see - that is a different issue to the one I was thinking of - apologies for the dead end - Odd sizes in the status bar is not something we have looked for or seen. We see the same small icon with the google generated circle in place of a proper largeIcon in our apps too.
So I found out a little bit more about the notification icons. We have been using a 128x128 notification icon in platform/android/res/drawable. In most cases, the system scales it properly, and it looks great. It's just that one situation where the push notification first appears on Lollipop devices -- it's not getting resized properly; instead, it's just cropped center. I've just been playing around with some sizes for the notification icon: platform/android/res/drawable-mdpi/foo.png - 24 px platform/android/res/drawable-hdpi/foo.png - 36 px platform/android/res/drawable-xhdpi/foo.png - 48 px platform/android/res/drawable-xxhdpi/foo.png - 72 px platform/android/res/drawable-xxhdpi/foo.png - 96 px (I also made it pure white with alpha to comply with Lollipop design guidelines). With these sizes, I don't get the zoomed in effect. It looks fine in all circumstances. On the white cards in the Lollipop notification tray, it shows up as a white icon on a colored circle (gray on a Nexus 7, light blue on a Galaxy S4). Support for the large icon would be nice for us, but I'm OK with the way things look in the interim.
PR: https://github.com/appcelerator/titanium_mobile/pull/6992
PR merged.
Verified the implementation. Large icon is displayed as expected when placed in the proper path. Closing. Environment: Appc Studio : 4.2.0.201508141038 Ti SDK : 5.0.0.v20150824091229 Ti CLI : 4.1.5 Alloy : 1.7.5 MAC Yosemite : 10.10.4 Appc NPM : 4.2.0-1 Appc CLI : 5.0.0-14 Node: v0.10.37 Nexus 5 - Android 5.1.1 Node : v0.10.37