如何在模拟器中测试 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 广播接收器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How To Create a Rotating Wheel Control?(如何创建转轮控件?)
How to avoid restarting activity when orientation changes on Android(如何在 Android 上的方向更改时避免重新启动活动)
Screen orientation lock(屏幕方向锁定)
Strange behavior with android orientation sensor(android方向传感器的奇怪行为)
Android: Rotate image in imageview by an angle(Android:将imageview中的图像旋转一个角度)
Activity restart on rotation Android(旋转Android上的活动重启)