大家好,想请教一个问题
我在android状态栏上显示自己app的图标是通过notification实现的,但是这样就出现了一个问题,只要在状态栏下拉列表中点击“清除”之后,自己app的图标就不见了,要重启app才会得到该通知图标。
但是我想实现只要自己的app没有关闭,该图标就一直显示,这就是说不能通过notification来实现状态栏的显示。
就像360的电池监控一样,并没有通过notification实现状态栏的显示,该进程是在状态栏的“正在进行”一栏中,而不是“通知”中请问如何实现像360电池监控那样的显示状态栏图标的方法?
谢谢大家

解决方案 »

  1.   

    问题解决了,参考了下android sdk的文档,原来notification有一个标记是public static final int FLAG_ONGOING_EVENTSince: API Level 1
    Bit to be bitwise-ored into the flags field that should be set if this notification is in reference to something that is ongoing, like a phone call. It should not be set if this notification is in reference to something that happened at a particular point in time, like a missed phone call.
    Constant Value: 2 (0x00000002)这样就实现了状态栏图标除了自己关闭app外不会被清除的功能谢谢大家
      

  2.   

    嗯,sdk文档是游戏规则说明书,开发者需要仔细阅读,心中有数
      

  3.   

       myNoti.flags=2;
    是这样吧
      

  4.   

    我是这样的,好望赐教    notification.flags |= Notification.FLAG_ONGOING_EVENT
      

  5.   

    Notification.flags = Notification.FLAG_ONGOING_EVENT;