3

我已經實現了BigTextStyle/InboxStyle通知,但是它顯示爲正常通知,它顯示在我的HTC One X上的JellyBean(意味着在薑餅,ICS等)之前& T(4.1.1)。即使行動按鈕也沒有顯示。Android JellyBean BigTextStyle通知不起作用 - HTC One X AT&T

我檢查我的代碼與模擬器(與果凍豆4.2),這是工作。

它看起來像豆形軟糖的新的通知系統不符合我的版本HTC的一個十

HTC執行One X的AT & T設備信息

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 

源代碼

@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()); 
} 

有沒有人知道爲什麼它不是爲我的設備工作?

+0

pre-JB?那是什麼意思 ? – Teovald

+0

preJB意思是在軟糖之前,因爲我們說preHoneycomb等 –

+0

我有同樣的問題。我的是micromax帆布a74.Did你有關於這個問題的任何信息? –

回答

1

嘗試使用NotificationCompat.Builder代替Notification.Builder。據此更改code.That應該work.And對方回答這個職位是重要

+0

我的HTC One X的4.1版本不支持新的果凍糖果通知。我已將手機更新至4.2版,現在支持所有這些通知。這是一個非常古老的帖子。 –