문제

I have written a simple BroadcastReceiver application in Android to monitor the incoming and outgoing calls... i would like test the BroadcastReceiver via emulator... can anyone please let me know how to execute the BroacastReceiver in emulator??

Thanks in advance :-)

도움이 되었습니까?

해결책 2

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

To stop an emulator instance, just close the emulator's window.

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

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

To Send Broadcast from CMD you can use this Command.

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


Read more about Android Emulator : Android Emulator and Using Emulator

다른 팁

You can use the Emulator Control View in Eclipse. This user interface allows you to send data to the emulator to emulate receiving an SMS message or phone call. Run the application in the emulator, and go to Window -> Show View -> Other -> Android -> Emulator Control. Enter incoming number and choose Voice option for call and SMS option for SMS.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top