gpt4 book ai didi

android - 如何增加 NotificationCompat 显示的时间

转载 作者:行者123 更新时间:2023-11-29 19:51:53 25 4
gpt4 key购买 nike

我正在使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com