我正在使用NotificationCompat显示来电,但问题是时间限制更短,我想显示NotificationCompat 40秒,有什么方法可以增加显示通知的时间,因为当前显示通知的时间少于40秒

    Intent dismissIntent = new Intent();
    PendingIntent piDismiss = PendingIntent.getService(ctx, 0,dismissIntent, 0);
    Intent callIntent = new Intent();
    PendingIntent pendingcall = PendingIntent.getService(ctx, 0, callIntent, 0);

    NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx).setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle("Ping Notification").setContentText("Tomorrow will be your birthday.")
            .setDefaults(Notification.DEFAULT_ALL).setPriority(NotificationCompat.PRIORITY_HIGH)
            .addAction(R.drawable.call_end, "Dismiss", piDismiss)
            .addAction(R.drawable.call_accept, "Accept", pendingcall);

    NotificationManager notificationManager = (NotificationManager) ctx
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(0, builder.build());


谢谢

最佳答案

平视通知的可见性长度已在操作系统中设置,无法更改

关于android - 如何增加NotificationCompat显示的时间,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37054447/

10-11 20:01