Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23645] Android notification: allow to set color of background

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2017-11-10T18:56:27.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.0.0
ComponentsAndroid
Labelsn/a
ReporterThibault Lenclos
AssigneeHans Knöchel
Created2016-07-06T15:41:45.000+0000
Updated2017-11-10T21:45:44.000+0000

Description

Currently we can't set the color of the circle notification on Android. T here is no method setColor on ti.cloudpush or style variable that we can override.

Comments

  1. Sharif AbuDarda 2016-07-15

    Hello, Thanks for submitting the request. Can you share a demonstration of how this works in native platform? Our engineers will look into it. We will let you know if and when we will include this feature in ti.cloudpush.
  2. Ayoub Zamouchi 2016-08-08

    This is the method used in native android development : [https://developer.android.com/reference/android/app/Notification.Builder.html#setColor(int)] , and this post describe how to do it : [http://stackoverflow.com/questions/27343202/changing-notification-icon-background-on-lollipop]
  3. David van de Meer 2017-09-18

    Has this still not been implemented??
  4. David van de Meer 2017-09-19

    @Eric Merriman - I have added a Pull request that adds this ability - as this is my first I have signed the CLA as well. I am not sure what other tests, docs etc need to be done or if there is anywhere else in the code you would like me to add this? One concern I have is that this will not work on Android < 5 and I see we still support Android 4. Will this automatically fail or should we code in some check to ignore it on Android 4? Usage:
       var notification = Titanium.Android.createNotification({
                   contentTitle: "Title",
                   contentText: "Content",
                   tickerText: "TickerTitle",
                   when: 0,
                   icon : Ti.App.Android.R.drawable.notification_icon_white,
                  flags : Titanium.Android.FLAG_NO_CLEAR | Titanium.Android.FLAG_ONGOING_EVENT,
                  contentIntent: pending,
                  color: "black", // #90B81A also works
               });
               
       Ti.Android.NotificationManager.notify(1, notification);
       
  5. Hans Knöchel 2017-10-25

    [~dieskim] Can you link your pull-request here? We are currently doing house-keeping for 7.0.0 and would need to reschedule it otherwise. Thank you!
  6. David van de Meer 2017-10-26

    sure but I am not sure what to do exactly...I thought it was already linked? Did you mean add a link here? https://github.com/appcelerator/titanium_mobile/pull/9444
  7. Hans Knöchel 2017-10-27

    Yes, thank you!
  8. Lokesh Choudhary 2017-11-10

    FR Passed. Waiting for merge to get enabled.
  9. Lokesh Choudhary 2017-11-10

    PR merged.
  10. Lokesh Choudhary 2017-11-10

    Verified the fix with SDK 7.0.0.v20171110104246. Closing. Studio Ver: 4.10.0.201709271713 SDK Ver: 7.0.0.v20171110104246 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.10 Appc CLI: 6.3.0 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.7 Node Ver: 7.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Nexus 6P --- Android 8.0.0

JSON Source