In the Notification class, there is a public field called when. According to the API:
The timestamp for the notification. The icons and expanded views are sorted by this key.
The default behaviour (for code and coders alike :) is to give when the timestamp of the notification:
notification.when = System.currentTimeMillis();
So - in order to maintain the correct order of notifications, all you need to do is give it a preset timestamp instead:
notification.when = previousTimestamp;
When you do this with all of your notifications, they maintain their order. I had the same problem as you and solved it this way.
记录第一次使用的时间戳,每次都使用相同的时间戳就可以了
本文探讨了在通知类中通过设置统一时间戳来维持通知正确顺序的解决方案,详细介绍了时间戳的获取与应用,以及如何通过实例解决实际问题。
615

被折叠的 条评论
为什么被折叠?



