問題描述
我想在 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
要停止模擬器實例,只需關(guān)閉模擬器窗口即可.
為了 Start/Restart
它從 Eclipse 的 AVD 管理器開始 并且您的帶有 BOOT_COMPLETE 操作的 BroadcastReceiver 將被調(diào)用肯定
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
轉(zhuǎn)到 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 發(fā)送廣播,您可以使用此命令.
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
<小時>
閱讀有關(guān) Android 模擬器的更多信息:Android 模擬器 和 使用模擬器
這篇關(guān)于如何在模擬器中測試 BOOT_COMPLETED 廣播接收器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!