Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How can I completely abort/remove sticky broadcast

We can remove an ordered broadcast with abortBroadcast(), is there a way to completely remove a sticky ordered broadcast?

like image 737
blackfyre Avatar asked Aug 07 '12 03:08

blackfyre


1 Answers

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)

like image 106
StenaviN Avatar answered Sep 23 '22 20:09

StenaviN