Android-开始地面行动未显示
我目前正在尝试创建一个带有操作的foregroundNotification,但操作+图标不会显示 这是我的密码:Android-开始地面行动未显示,android,service,Android,Service,我目前正在尝试创建一个带有操作的foregroundNotification,但操作+图标不会显示 这是我的密码: Intent intent = new Intent(KEY); PendingIntent nextIntent = PendingIntent.getBroadcast(this, 0, intent, 0); // Build the notification that tells the user that the serv
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()方法实现吗。