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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With