[英]Create notification without it popping up
I'm trying to add an android notification to the "tray" in android 3, but I don't want it to "pop up" every time I call notify(). 我正在尝试向android 3中的“托盘”添加一个android通知,但我不希望每次调用notify()时它都会“弹出”。
I managed to kind of do this by setting the FLAG_ONLY_ALERT_ONCE flag on the notification, but it will still alert when I set it for the first time. 我设法通过在通知上设置FLAG_ONLY_ALERT_ONCE标志来做到这一点,但是当我第一次设置它时它仍然会发出警报。
It seems like this is possible, but I'm not sure how to do this (an example is the Prime ROM for the Asus transformer. When you plug in the dock, a new ongoing notification will be added to the notification area, but there is no alert, or "popup" there.. It just adds another icon to the list quietly. How can I do the same? 看起来这是可能的,但我不知道如何做到这一点(一个例子是华硕变压器的Prime ROM。当你插入基座时,一个新的持续通知将被添加到通知区域,但那里没有警报,或“弹出”那里..它只是静静地在列表中添加另一个图标。我怎么能这样做?
Just set the tickerText
to null. 只需将tickerText
设置为null即可。 You can do this when creating your notification with: 您可以在创建通知时执行以下操作:
Notification notification = new Notification( R.drawable.icon, null, System.currentTimeMillis());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.