问题
We can remove an ordered broadcast with abortBroadcast()
, is there a way to completely remove a sticky ordered broadcast?
回答1:
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.
http://developer.android.com/reference/android/content/Context.html#removeStickyBroadcast(android.content.Intent)
来源:https://stackoverflow.com/questions/11839043/android-how-can-i-completely-abort-remove-sticky-broadcast