如何在模拟器中测试 BOOT_COMPLETED 广播接收器

How To Test BOOT_COMPLETED Broadcast Receiver In Emulator(如何在模拟器中测试 BOOT_COMPLETED 广播接收器)

本文介绍了如何在模拟器中测试 BOOT_COMPLETED 广播接收器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 emulator 中使用操作 BOOT_COMPLETED 检查 BROADCAST RECEIVER.

I want to check the BROADCAST RECEIVER with Action BOOT_COMPLETED in the emulator.

有什么方法可以检查模拟器中的广播接收器吗?如何重新启动模拟器以检查该接收器?有没有直接的命令?

Is there any way to check that broadcast receiver in emulator ? How can i restart emulator to check that receiver ? is there any direct command?

提前致谢.

推荐答案

模拟器中没有像Devices那样的电源按钮,所以

There is no Power Button in Emulator like Devices have,So

要停止模拟器实例,只需关闭模拟器窗口即可.

为了 Start/Restart从 Eclipse 的 AVD 管理器开始 并且您的带有 BOOT_COMPLETE 操作的 BroadcastReceiver 将被调用肯定

And To Start/Restart it Start from AVD Manager of Eclipse and Your BroadcastReceiver with BOOT_COMPLETE action will get called for sure

你也可以用另一种方式启动 AVD,从 CMD 转到 AndroidSDK 的工具 并给出这个命令 E:android-sdk-windows ools>模拟器 -avd AVDNAMEHERE

You can start AVD another way also, From CMD go to Tools of AndroidSDK and give this commmand E:android-sdk-windows ools>emulator -avd AVDNAMEHERE

从 CMD 发送广播,您可以使用此命令.

To Send Broadcast from CMD you can use this Command.

adb shell am 广播 -a android.intent.action.BOOT_COMPLETED -candroid.intent.category.HOME -n package_name/class_name

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n package_name/class_name

<小时>

阅读有关 Android 模拟器的更多信息:Android 模拟器 和 使用模拟器

这篇关于如何在模拟器中测试 BOOT_COMPLETED 广播接收器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何在模拟器中测试 BOOT_COMPLETED 广播接收器

基础教程推荐