I need to stub out the GSM network on a test android device for testing开发者_开发问答 some parts of an application. Is this possible?
Thanks
The Android Emulator has a console that can be used to simulate many, many different conditions within the emulator. Have a look a the telephony emulation section, it may help you to test the necessary parts of your application.
For example, the gsm
command allows you to enter a command like this:
gsm data roaming
to simulate your phone roaming. What, specifically, were you going to try to stub out?
You haven't really explained what you mean by "stub out"
If you mean simply disable, you can edit the APN settings (after writing them down!) to break the network, or remove the SIM card (assuming the device uses one)
If you mean use something else instead, most every android phone supports wifi, and you could put whatever monitoring/simulation/etc you want upstream of a cheap wireless access point.
If you want to do it in software... not so easy. On a rooted phone you could monkey around with the network configuration or drivers, basically as on any other linux only making sure that you don't get in a fight with the android platform, each reverting the other's network settings.
精彩评论