How to emulate cellular to wifi (or vice versa) switch on android emulator -
i developing module downloads off internet. using asynctask download , tracking download process via flag iscomplete
. requirement whenever application switches network cellular wifi or vice versa, should restart download. haev implemented via broadcast receiver listens intent android.net.conn.connectivity_changed
, starts redownloading.
@override onreceive(...){ if(!iscomplete){ reload(); } }
i want test tis on simulator many reasons such dont have device has cellurla connection , debugging easy on emulator.
is there way can test network switch or fire android.net.conn.connectivity_change outside app?
please advice!
adb shell broadcast -a intent_name -c intent_category -n package_name/class_name
this send intent. i've used emulate boot completed in past make sure services started on boot. i'm not sure parts optional though (i think package/class name are).
Comments
Post a Comment