gpt4 book ai didi

android - 不要让推送通知下拉

转载 作者:行者123 更新时间:2023-11-29 18:44:05 26 4
gpt4 key购买 nike

在通话期间,我想显示一个持久的推送通知,以便在用户退出应用程序时单击通知并将他带回屏幕。我在 Oreo 上遇到的一个问题(这是我唯一注意到的地方)与 7.0 不同,它不仅会在顶部显示图标,还会在整个屏幕上下拉通知并将其隐藏一段时间后。有没有办法禁用此功能?即:我不希望它像这样显示:

enter image description here

最佳答案

我想下面的方法可能对你有帮助。在通知管理器类中找到它。

/**
* Sets the current notification interruption filter.
* <p>
* The interruption filter defines which notifications are allowed to
* interrupt the user (e.g. via sound &amp; vibration) and is applied
* globally.
* <p>
* Only available if policy access is granted to this package. See
* {@link #isNotificationPolicyAccessGranted}.
*/
public final void setInterruptionFilter(@InterruptionFilter int interruptionFilter) {
final INotificationManager service = getService();
try {
service.setInterruptionFilter(mContext.getOpPackageName(), interruptionFilter);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}

关于android - 不要让推送通知下拉,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52398428/

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