如何设置广播接收器 [英] How do I set a broadcast receiver

查看:97
本文介绍了如何设置广播接收器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置一个广播接收器,使其在收到广播消息时运行某些功能,在此示例中,我想捕捉下载的管理员意图:

I want to set a broadcast receiver to run some function when it gets the broadcast message, in this example, I want to catch the download's manager intent:

DownloadManager.ACTION_DOWNLOAD_COMPLETE

我查看了Android API示例,但没有找到一种方法

I looked at the Android API examples and haven't found a way to do this

推荐答案

您应该先阅读以下内容:

You should read this first:

http://developer.android.com/reference/android/content/BroadcastReceiver.html

然后在这里查看示例.

Android示例: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/appwidget/ExampleBroadcastReceiver.html

博客文章: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆