我目前正在尝试创建一个带有动作的foregroundNotification,但是动作+图标不会显示。
下面是我的代码:
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搜索...”、“作为媒体设备连接”等)。你知道为什么会发生这样的事情吗?
发布于 2014-01-31 06:31:19
操作未显示,因为通知可能未展开。通过用两个手指向下滑动/滚动来扩展它。
https://stackoverflow.com/questions/19394307
复制相似问题