如何通过ADB更改网络状态? [英] how do I change the network state over ADB?

查看:401
本文介绍了如何通过ADB更改网络状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个模拟器,我想在我的应用程序中模拟数据连接的丢失。我已经正确设置了接收器,但是我需要一种通过adb更改数据连接的方法。

I have an emulator that I want to simulate the loss of a data connection while in my app. I have the receiver's setup correctly but I need a way to change the data connection via adb.

是否有一个ADB命令可以关闭数据连接?

Is there an ADB command that turns off the data connection?

推荐答案

您可以通过telnet连接到仿真器

You can connect to an emulator via telnet

telnet localhost 5554

一旦连接,就可以设置网络速度。

once connected you can set the network speed.

network speed 0

gsm data off 

也许您发现此链接有用。

maybe you find this link helpful.

http://developer.android.com/guide/developing/devices/emulator.html#emulatornetworking

这篇关于如何通过ADB更改网络状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆