How To Test BOOT_COMPLETED Broadcast Receiver In Emulator(如何在模拟器中测试 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 广播接收器
基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
