2
我目前正在嘗試創建一個帶有動作的foregroundNotification,但動作+圖標不會顯示。Android - startForeground動作沒有顯示
這裏是我的代碼:
Intent intent = new Intent(KEY);
PendingIntent nextIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
// Build the notification that tells the user that the service
// is ongoing
NotificationCompat.Builder foregroundNoteBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(....)
.setContentTitle(....)
.setContentText(....)
.addAction(R.drawable.pause, "Pause all messages", nextIntent);
Notification note = foregroundNoteBuilder.build();
// Update the notification
startForeground(1, note);
前景通知顯示沒有動作。有什麼建議麼?謝謝。
編輯: 顯然,當通知托盤中存在任何其他通知(例如,「使用GPS搜索...」,「作爲媒體設備連接」等)時,會發生這種情況。任何想法爲什麼發生這種情況?
你可以請你發佈你的整個代碼,即startForeground()方法的實現。 –