安卓:我怎样才能彻底中止/删除持久广播 [英] Android: How can I completely abort/remove sticky broadcast
问题描述
我们可以删除与abortBroadcast()一个有序的广播,有没有办法彻底清除粘有序的广播?
removeStickyBroadcast
正是你所需要的:
公共抽象无效removeStickyBroadcast(意向意图)
由于:API级别1
删除数据$ P $与
sendStickyBroadcast pviously发送(意向)
,这样就好像粘广播从来没有发生过。您必须持有
BROADCAST_STICKY
许可才能使用这个API。如果你不持有该权限,则抛出SecurityException。参数
意图的,这是previously广播的意图。
<一个href="http://developer.android.com/reference/android/content/Context.html#removeStickyBroadcast(android.content.Intent">http://developer.android.com/reference/android/content/Context.html#removeStickyBroadcast(android.content.Intent)
We can remove an ordered broadcast with abortBroadcast(), is there a way to completely remove a sticky ordered broadcast?
removeStickyBroadcast
is exactly what you need:
public abstract void removeStickyBroadcast (Intent intent)
Since: API Level 1
Remove the data previously sent with
sendStickyBroadcast(Intent)
, so that it is as if the sticky broadcast had never happened.You must hold the
BROADCAST_STICKY
permission in order to use this API. If you do not hold that permission, SecurityException will be thrown.Parameters
intent The Intent that was previously broadcast.
这篇关于安卓:我怎样才能彻底中止/删除持久广播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!