广播字段
BATTERY_CHANGED_ACTION 充电状态,或者电池的电量发生变化 "android.intent.action.BATTERY_CHANGED"
BOOT_COMPLETED_ACTION 在系统启动后,这个动作被广播一次(只有一次) "android.intent.action.BOOT_COMPLETED"
CALL_FORWARDING_STATE_CHANGED_ACTION 语音电话的呼叫转移状态已经改变 "android.intent.action.CFF"
CONFIGURATION_CHANGED_ACTION 设备的配置信息已经改变,参见 Resources.Configuration. "android.intent.action.CONFIGURATION_CHANGED" Creator CREATOR 无 无
DATA_ACTIVITY_STATE_CHANGED_ACTION 电话的数据活动(data activity)状态(即收发数据的状态)已经改变。"android.intent.action.DATA_ACTIVITY"
DATA_CONNECTION_STATE_CHANGED_ACTION 电话的数据连接状态已经改变 "android.intent.action.DATA_STATE"
DATE_CHANGED_ACTION 日期被改变 "android.intent.action.DATE_CHANGED"
FOTA_CANCEL_ACTION 取消所有被挂起的 (pending) 更新下载 "android.server.checkin.FOTA_CANCEL"
FOTA_INSTALL_ACTION 更新已经被确认,马上就要开始安装 "android.server.checkin.FOTA_INSTALL"
FOTA_READY_ACTION 更新已经被下载,可以开始安装 "android.server.checkin.FOTA_READY"
FOTA_RESTART_ACTION 恢复已经停止的更新下载 "android.server.checkin.FOTA_RESTART"
FOTA_UPDATE_ACTION 通过 OTA 下载并安装操作系统更新 "android.server.checkin.FOTA_UPDATE"
MEDIABUTTON_ACTION 用户按下了“Media Button” "android.intent.action.MEDIABUTTON"
MEDIA_BAD_REMOVAL_ACTION 扩展介质(扩展卡)已经从 SD 卡插槽拔出,但是挂载点 (mount point) 还没解除 (unmount) "android.intent.action.MEDIA_BAD_REMOVAL"
MEDIA_EJECT_ACTION 用户想要移除扩展介质(拔掉扩展卡) "android.intent.action.MEDIA_EJECT"
MEDIA_MOUNTED_ACTION 扩展介质被插入,而且已经被挂载 "android.intent.action.MEDIA_MOUNTED"
MEDIA_REMOVED_ACTION 扩展介质被移除。 "android.intent.action.MEDIA_REMOVED"
MEDIA_SCANNER_FINISHED_ACTION 已经扫描完介质的一个目录 "android.intent.action.MEDIA_SCANNER_FINISHED"
MEDIA_SCANNER_STARTED_ACTION 开始扫描介质的一个目录 "android.intent.action.MEDIA_SCANNER_STARTED"
MEDIA_SHARED_ACTION 扩展介质的挂载被解除 (unmount),因为它已经作为 USB 大容量存储被共享 "android.intent.action.MEDIA_SHARED"
MEDIA_UNMOUNTED_ACTION 扩展介质存在,但是还没有被挂载 (mount) "android.intent.action.MEDIA_UNMOUNTED"
MESSAGE_WAITING_STATE_CHANGED_ACTION 电话的消息等待(语音邮件)状态已经改变 "android.intent.action.MWI"
TIMEZONE_CHANGED_ACTION 时区已经改变 "android.intent.action.TIMEZONE_CHANGED"
TIME_CHANGED_ACTION 时间已经改变(重新设置) "android.intent.action.TIME_SET"
TIME_TICK_ACTION 当前时间已经变化(正常的时间流逝) "android.intent.action.TIME_TICK"
UMS_CONNECTED_ACTION 设备进入 USB 大容量存储模式 "android.intent.action.UMS_CONNECTED"
UMS_DISCONNECTED_ACTION 设备从 USB 大容量存储模式退出 "android.intent.action.UMS_DISCONNECTED"
WALLPAPER_CHANGED_ACTION 系统的墙纸已经改变 "android.intent.action.WALLPAPER_CHANGED"
XMPP_CONNECTED_ACTION XMPP 连接已经被建立 "android.intent.action.XMPP_CONNECTED"
XMPP_DISCONNECTED_ACTION XMPP 连接已经被断开 "android.intent.action.XMPP_DI
NETWORK_TICKLE_RECEIVED_ACTION 设备收到了新的网络 "tickle" 通知 "android.intent.action.NETWORK_TICKLE_RECEIVED"
PACKAGE_ADDED_ACTION 设备上新安装了一个应用程序包 "android.intent.action.PACKAGE_ADDED"
PACKAGE_REMOVED_ACTION 设备上删除了一个应用程序包 "android.intent.action.PACKAGE_REMOVED"
PHONE_STATE_CHANGED_ACTION 电话状态已经改变 "android.intent.action.PHONE_STATE"
PROVIDER_CHANGED_ACTION 更新将要(真正)被安装 "android.intent.action.PROVIDER_CHANGED"
PROVISIONING_CHECK_ACTION 要求 polling of provisioning service 下载最新的设置 "android.intent.action.PROVISIONING_CHECK"
SCREEN_OFF_ACTION 屏幕被关闭 "android.intent.action.SCREEN_OFF"
SCREEN_ON_ACTION 屏幕已经被打开 "android.intent.action.SCREEN_ON"
SERVICE_STATE_CHANGED_ACTION 电话服务的状态已经改变 "android.intent.action.SERVICE_STATE"
SIGNAL_STRENGTH_CHANGED_ACTION 电话的信号强度已经改变 "android.intent.action.SIG_STR"
STATISTICS_REPORT_ACTION 要求 receivers 报告自己的统计信息 "android.intent.action.STATISTICS_REPORT"
STATISTICS_STATE_CHANGED_ACTION 统计信息服务的状态已经改变 "android.intent.action.STATISTICS_STATE_CHANGED"
其它
快捷方式的添加与删除都是通过广播来实现
添加快捷方式:
private static final String ACTION_INSTALL_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT";
Intent shortcutIntent = new Intent(ACTION_INSTALL_SHORTCUT);
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));//快捷方式的名称
shortcutIntent.putExtra(EXTRA_SHORTCUT_DUPLICATE, false);//是否允许重复创建快捷方式
Intent intent = new Intent();
intent.setComponent(new ComponentName(this.getPackageName(),".XxxActivity"));//设置要激活的Activity
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);//点击快捷方式后发送一个Intent
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, R.drawable.icon));
sendBroadcast(shortcutIntent);
权限:
<uses-permission
android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
删除快捷方式:
Intent intent = new Intent(DELETE_ACTION);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Sample");
ComponentName comp = new ComponentName("com.example.android.apis","com.example.android.apis.app.LauncherShortcuts");
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent().setComponent(comp).setAction("android.intent.action.MAIN"));
sendBroadcast(intent);
权限:
<uses-permission
android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
网友评论