Android BroadcastReceiver示例教程

Today we’ll discuss and implement Android BroadcastReceiver that is a very important component of Android Framework.

今天,我们将讨论和实现Android BroadcastReceiver,它是Android Framework的非常重要的组成部分。

Android BroadcastReceiver (Android BroadcastReceiver)

Android BroadcastReceiver is a dormant component of android that listens to system-wide broadcast events or intents.

Android BroadcastReceiver是android的Hibernate组件,它侦听系统范围的广播事件或Intent

When any of these events occur it brings the application into action by either creating a status bar notification or performing a task.

这些事件中的任何一个发生时,它都会通过创建状态栏通知或执行任务来使应用程序生效。

Unlike activities, android BroadcastReceiver doesn’t contain any user interface. Broadcast receiver is generally implemented to delegate the tasks to services depending on the type of intent data that’s received.

与活动不同,Android BroadcastReceiver不包含任何用户界面。 广播接收器通常实现为根据接收到的意图数据的类型将任务委托给服务。

Following are some of the important system wide generated intents.

以下是一些在系统范围内产生的重要意图。

  1. android.intent.action.BATTERY_LOW : Indicates low battery condition on the device.

    android.intent.action.BATTERY_LOW :指示设备的电池电量不足。
  2. android.intent.action.BOOT_COMPLETED : This is broadcast once, after the system has finished booting

    android.intent.action.BOOT_COMPLETED :系统完成启动后,将广播一次
  3. android.intent.action.CALL : To perform a call to someone specified by the data

    android.intent.action.CALL :对数据指定的某人执行呼叫
  4. android.intent.action.DATE_CHANGED : The date has changed

    android.intent.action.DATE_CHANGED :日期已更改
  5. android.intent.action.REBOOT : Have the device reboot

    android.intent.action.REBOOT :重启设备
  6. android.net.conn.CONNECTIVITY_CHANGE : The mobile network or wifi connection is changed(or reset)

    android.net.conn.CONNECTIVITY_CHANGE :移动网络或wifi连接已更改(或重置)

Android中的广播接收器 (Broadcast Receiver in Android)

To set up a Broadcast Receiver in android application

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值