开发者

How do you stop a broadcast intent?

开发者 https://www.devze.com 2023-03-14 14:25 出处:网络
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.

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

精彩评论

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