Well, I have searched a lot. People say that I need to close the window of emulator to close it. However, I need to reboot the emulator to catch ACTION_BOOT_COMPLETE
D by my BroadcastReceiver
.
How can I do that?
Well, I have searched a lot. People say that I need to close the window of emulator to close it. However, I need to reboot the emulator to catch ACTION_BOOT_COMPLETE
D by my BroadcastReceiver
.
How can I do that?
You can use the following command from adb:
adb shell am activity/service/broadcast -a ACTION -c CATEGORY -n NAME
for example:
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n package_name/class_name
Note that class name and package names need to be as defined in the Manifest.
This will generate the Intent you want , directed only to the component you want (otherwise you system will go crazy with BOOT_COMPLETED sent...)
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=7432, uid=2000
–
Keitloa Or another way (also from the command line):
adb shell stop
adb shell start
stop: must be root
whilst Android 7.1.1 emulator is running –
Keitloa adb -e root
in my terminal and it printed restarting adbd as root
. After that I was able to run these commands. –
Mucoviscidosis First, make sure that USB Debugging is enabled from within the emulator:
click:
from a command-line:
adb -e reboot
EDIT:
This definitely doesn't work... very strange. I tested it and could not make the emulator reboot. It just hangs.
adb reboot
successfully? I run it for 45 mins, the process emulator-arm
keeps using 50% of CPU. It's not responding :-( –
Heaton To emulate a broadcast action, you can connect via adb to the emulator/device and open a shell:
adb shell
Then, you can broadcast the action you want to test:
am broadcast -a android.intent.action.BOOT_COMPLETED
Please note that, in the latest Android versions, broadcasting the *android.intent.action.BOOT_COMPLETED* action will actually reboot your emulator/device.
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=6832, uid=2000
–
Keitloa While using tubemate
on android tab, I was not successful in downloading video with the error:host interupped
etc. I used the following commands:
adb shell stop
adb shell start
and the application started downloading videos.
emulators have on/off button - just click it
and another way:
If you start your emulator, and select the "wipe user data" checkbox, you will also receive that notification when boot is completed.
© 2022 - 2024 — McMap. All rights reserved.