开发者

How do you stop a broadcast intent?

What is the code to stop or finish broadcast intent? I want to stop the reciever when a button is clic开发者_开发百科ked.


You don't stop a BroadcastReceiver.. you may try using a Service instead.

public abstract void onReceive (Context context, Intent intent)

Since: API Level 1 This method is called when the BroadcastReceiver is receiving an Intent broadcast. During this time you can use the other methods on BroadcastReceiver to view/modify the current result values. The function is normally called within the main thread of its process, so you should never perform long-running operations in it (there is a timeout of 10 seconds that the system allows before considering the receiver to be blocked and a candidate to be killed). You cannot launch a popup dialog in your implementation of onReceive().

http://developer.android.com/reference/android/content/BroadcastReceiver.html#onReceive(android.content.Context, android.content.Intent)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜