每个应用程式的android系统通知限制 [英] android system notification limit per app
问题描述
这可能不是主题,但我找不到任何东西.
This may be off topic , but I couldn't found anything for it.
Android应用可以显示的通知数量是否有限制?我在收到100条通知后遇到了问题.没有文档可以清楚地说明这一点.
Is there any limit on the number of notifications android app can display?I am facing issue after 100 notifications. There is no documentation which states this clearly.
注意:这并不是显示100条通知的好主意,但出于某些原因是必需的.
Note: This is not really a good idea to show 100 notifications but It is required for certain reasons.
任何帮助都会很好.
推荐答案
根据@Nirel的回答.
According to @Nirel's answer.
1)我试图在3种不同的设备上运行代码.
1) I tried to run the code in 3 different devices.
令人惊讶的是,通知区域中未显示超过 50 的通知.
Surprisingly notifications beyond 50 are not showing in notification area.
出现以下错误.
W/NotificationManager﹕ notify: id corrupted: sent 51, got back 0
以后的通话也会出现相同的错误.
The same error comes for subsequent calls.
我看到了NotificationManager的来源,如果传入和传出ID不相同,则会出现此错误.参见下面的代码.
I saw the source of NotificationManager , it gives this error if incoming and out id is not same. See below code.
2)之后,我尝试以100毫秒的间隔进行通知.
2) After I tried to notify on intervals of 100 milliseconds.
它也给出相同的错误.我试过的是在执行代码时删除了1条通知.
It also Gives the same error. What I tried is removed 1 notification when code is executed.
令人惊讶的是,状态栏中出现了通知号153.
Surprisingly , notification number 153 came in status bar.
因此得出的结论是,最多可以有50条通知.这可能是默认行为,并且可以由制造商更改,如@Sharp Edge所述.
So the conclusion is that , at most 50 notifications can be there. This may be default behaviour and may can change by manufacturer as said by @Sharp Edge.
Thnx.
这篇关于每个应用程式的android系统通知限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!