【发布时间】:2016-05-10 22:21:32
【问题描述】:
我正在尝试修复始终位于通知栏顶部的四个无法关闭的按钮。首次启动应用程序时,按钮将始终固定。为此,我通过 Notification Builder 创建通知,如下所示。
Notification notification = new Notification.Builder(this).build();
notification.flags = Notification.FLAG_ONGOING_EVENT;
notification.icon = R.drawable.ic_launcher;
notification.contentIntent = pendingIntent;
notification.setSmallIcon = R.drawable.ic_launcher;
notification.flags = Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR;
notification.priority = Notification.PRIORITY_HIGH;
mNotificationManager.notify(Constants.NOTIFICATION_ID_BRANDING, notification);
一切正常,我什至可以在顶部显示我的通知,但是当我收到来自不同应用程序的其他通知时,我的通知显示在该应用程序下方。
notification.priority = Notification.PRIORITY_HIGH; 行会做这件事,但它只针对我们的应用程序。
我的要求:但我的要求是无论任何通知如何,我的通知始终位于顶部。请帮助我提供您的提示和解决方案。提前致谢。
【问题讨论】:
标签: android notifications android-notification-bar android-remoteview custom-notification