Pin Notification to top of notification area

前端 未结 8 1690
有刺的猬
有刺的猬 2020-12-09 05:35

I have a Notification which is refreshed (i.e. sent) every three seconds. I\'ve set the FLAG_ONGOING_EVENT flag and the FLAG_NO_CLEAR flag so that is always shown. The probl

相关标签:
8条回答
  • 2020-12-09 06:11

    Are you sending a new notification each time, or updating an existing one? Can you post the code?

    In the meantime, you can generally answer questions like "Can I pin my notification to a static position, or to the top of the list" by thinking "Wait, what would happen if two or more programs both tried to pin their notification to be first?" and realising that the arms-race that would ensue amongst programs as they try ever harder to make sure their notification is first is why this sort of feature is not supported.

    0 讨论(0)
  • 2020-12-09 06:11

    There is an Ongoing Event Flag. http://developer.android.com/reference/android/app/Notification.html#FLAG_ONGOING_EVENT

    You don't need the Notification.FLAG_NO_CLEAR flag.

    0 讨论(0)
提交回复
热议问题