Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/156.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android-开始地面行动未显示_Android_Service - Fatal编程技术网

Android-开始地面行动未显示

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

我目前正在尝试创建一个带有操作的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搜索…”、“作为媒体设备连接”等),就会发生这种情况。你知道为什么会这样吗

操作未显示,因为通知可能未展开。通过用两个手指向下滑动/滚动来展开它。

您可以发布您的全部代码,即startForeground()方法实现吗。