4

I have implemented a BigTextStyle/InboxStyle notification but it is shown as a normal Notification which is shown before JellyBean (means in Gingerbread, ICS etc) on my HTC One X AT&T (which is 4.1.1). Even the action buttons are also not shown.

I have check my code with emulator (with JellyBean 4.2) and that is working.

It looks like new Notification System of JellyBean is not implemented with my version of HTC One X.

HTC One X AT&T Device Info

Android Version - 4.1.1 
HTC Sense Version - 4+ 
Software number - 3.18.502.6 710RD 
HTC SDK API Level - 4.63 
HTC Extension version - HTCExtension_Sesnse45_2

Source Code

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void showNotificationJB(Reminder reminder, Intent intent) {

    Log.v(TAG, "Showing BigText Notification");

    Notification.Builder builder = new Notification.Builder(this);
    builder.setContentTitle("Ezeetrak Scheduler");

    AdditionalDataStore store = reminder.getStore(); 

    String passedBy = store.optString("passedBy");

    builder.setContentText("Recieved an Event by " + passedBy);
    builder.setTicker("Recieved an Event by " + passedBy);
    builder.setSmallIcon(R.drawable.ic_launcher);

    Notification.InboxStyle inboxStyle = new Notification.InboxStyle();
    inboxStyle.addLine(Html.fromHtml("<b>Name: </b>" + reminder.getEventName()));
    inboxStyle.addLine(Html.fromHtml("<b>Date: </b>" + DateTimeHelper.DateFormat.format(reminder.getEventDate())));
    inboxStyle.addLine(Html.fromHtml("<b>Time: </b>" + reminder.getEventTimeFormatted()));
    inboxStyle.addLine(Html.fromHtml("<b>Sent By: </b>" + passedBy));
    inboxStyle.setBigContentTitle("Ezeetrak Scheduler");

    builder.setStyle(inboxStyle);

    PendingIntent acceptPendingIntent = buildPendingIntent(ReminderActivity.ACTION_ACCEPT, intent, 0);
    PendingIntent rejectPendingIntent = buildPendingIntent(ReminderActivity.ACTION_REJECT, intent, 1);

    builder.setContentIntent(buildPendingIntent(ReminderActivity.ACTION_VIEW, intent, 2));
    builder.addAction(R.drawable.ic_action_accept, "Accept", acceptPendingIntent);
    builder.addAction(R.drawable.ic_action_reject, "Reject", rejectPendingIntent);
    builder.setAutoCancel(false);

    NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    notificationManager.notify(REMINDER_SHARE_ACTION, builder.build());
}

Do anyone have idea why it's not working for my device?

Vivek Khandelwal
  • 7,829
  • 3
  • 25
  • 40

2 Answers2

9

The BigTextStyle notification in Android 4.1 needs two fingers to expand it.

In Android 4.2, only one finger is required. See the video for reference. http://www.youtube.com/watch?v=a6dzMzklEd4

tim
  • 627
  • 2
  • 7
  • 15
1

Try using NotificationCompat.Builder instead of Notification.Builder.Accordingly change your code.That should work.And The other answer to this post is important.

Sash_KP
  • 5,551
  • 2
  • 25
  • 34
  • 4.1 version of my HTC One X was not having support for new JellyBean Notification. I have updated my phone to 4.2 and now its supporting all those notification. This a very old post. – Vivek Khandelwal Aug 05 '14 at 05:57