0

Hi, Tried to override the push notification status. As I am working on cross platform application I felt difficulty to override the native functionality. What I am looking for is based on device OS. I need to show different types of notification.


We know that kitkat able to show inboxstyle with summary text but in ics its not posssible. In my app, I am able to show notification in kitkat but in ICS only content title is getting displayed, not message.

    if(Build.VERSION.SDK_INT <= 4.4){
 // Entering into loop if the device is below kitkat version
            if (message != null) {

                mBuilder.setContentTitle(message);
                mBuilder.setContentText(message);
                //mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(message));
            } else {
                mBuilder.setContentText("<missing message content>");
            }

        }else{
            if (message != null) {
                inboxStyle.setSummaryText(message);
                inboxStyle.setBigContentTitle(Html.fromHtml("<font weight='bold' color='Red' size='larger'>Alerts</font>"));
                  inboxStyle.addLine(Html.fromHtml("<span style=\"background: red;\"><font weight='bold' color='white' size='large'>"+message+"</font></span>"));

            } else {
            inboxStyle.setBigContentTitle(Html.fromHtml("<font weight='bold' color='Red' size='larger'>Alerts</font>"));
              inboxStyle.addLine(Html.fromHtml("<p><font weight='bold' color='white' size='small'>missing message content</font></p>"));
            }
             mBuilder.setStyle(inboxStyle);
        }

Can u share some inbox style format? Even span background color is also not applying.

Krupa Patel
  • 3,309
  • 3
  • 23
  • 28
RED.Skull
  • 1,696
  • 3
  • 24
  • 49

1 Answers1

0

You'll need to use RemoteViews for custom layouts (when you want to play with colours / text size / images etc. Check out this answer : Change Notification Layout

Also, to support notification building for various various versions of android. I'd suggest using NotificationCompat.Builder It'll automatically modify notifications based on the features supported in that particular android version. Check out this answer : How to create a notification with NotificationCompat.Builder?

Community
  • 1
  • 1
Shivam Verma
  • 7,973
  • 3
  • 26
  • 34