gpt4 book ai didi

Android:我怎样才能完全中止/删除粘性广播

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:22:20 24 4
gpt4 key购买 nike

我们可以使用 abortBroadcast() 移除一个ordered broadcast,有没有办法完全移除一个sticky ordered broadcast

最佳答案

removeStickyBroadcast 正是您所需要的:

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)

关于Android:我怎样才能完全中止/删除粘性广播,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11839043/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com