简体   繁体   中英

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().

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.

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?

Just set the tickerText to null. You can do this when creating your notification with:

Notification notification = new Notification( R.drawable.icon, null, System.currentTimeMillis());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM