我想测试我的应用程序的低网络连接的情况。除了站在电梯里,还有什么最好的方法呢?我试过用铝箔纸包我的手机,但没有用。
我需要在真正的设备上测试它,而不是在模拟器上。
我想测试我的应用程序的低网络连接的情况。除了站在电梯里,还有什么最好的方法呢?我试过用铝箔纸包我的手机,但没有用。
我需要在真正的设备上测试它,而不是在模拟器上。
当前回答
运行>运行配置,选择Android应用程序,然后进入目标选项卡。按照图中所示进行更改。
其他回答
有一种在真实设备上测试低速的简单方法似乎被忽视了。它确实需要一台Mac电脑和以太网(或其他有线)网络连接。
在Mac上打开Wifi共享,把你的电脑变成Wifi热点,把你的设备连接到这个。使用Netlimiter/Charles Proxy或Network Link Conditioner(您可能已经安装了)来控制速度。
欲了解更多详细信息,并了解您应该在签出时测试什么样的速度:http://opensignal.com/blog/2016/02/05/go-slow-how-why-to-test-apps-on-poor-connections/
更新到Android Studio v 1.5或更高版本 正如@LouMorda在下面的评论中提到的,在最初的帖子中提到的模拟器选项卡已经在Android Studio v 1.5中被删除了。
现在他们把这些设置放在AVD管理器的模拟器设置中。 要访问这些设置:
选择“Tools -> Android -> AVD Manager” 点击编辑AVD按钮(铅笔图标) 单击“显示高级设置”按钮后,可以访问“网络设置”
下面是它的屏幕截图:
最初的发布 对于使用Android Studio IDE的人:
执行->编辑配置 选择Android应用程序->[您的应用程序] 选择模拟器选项卡 在这里,您可以更改网络速度(网速)和网络延迟(延迟)的不同值,以模拟不同的速度和延迟等
或者,您可以在其他命令行选项文本字段中输入各种参数,如@inazaruk的回答中所述。
下面的截图描述了运行配置界面的样子:
我知道现在回答这个问题有点晚了,但我希望这能帮助其他面临类似问题的人!
编辑 对于任何使用eclipse的人,请参阅下面@Abhi的回答。
您是想测试没有网络连接,还是只是网络连接很慢?如果是前者,可以进入设置>无线和网络>飞行模式,打开飞行模式。这将允许您在实际设备上测试网络不可用性。
我有个办法解决你的问题。您可以使用代理程序来修改或监视您的网络状态。例如,查尔斯。
你应该改变默认配置的查尔斯像下面的图片我张贴。
最后,你会发现网速已经被塑造成较低的速度。
Facebook建立了一个叫做增强交通控制的东西。GitHub页面上的简要总结:
Augmented Traffic Control (ATC) is a tool to simulate network conditions. It allows controlling the connection that a device has to the internet. Developers can use ATC to test their application across varying network conditions, easily emulating high speed, mobile, and even severely impaired networks. Aspects of the connection that can be controlled include: bandwidth latency packet loss corrupted packets packets ordering In order to be able to shape the network traffic, ATC must be running on a device that routes the traffic and sees the real IP address of the device, like your network gateway for instance. This also allows any devices that route through ATC to be able to shape their traffic. Traffic can be shaped/unshaped using a web interface allowing any devices with a web browser to use ATC without the need for a client application.
你可以在GitHub上找到它:https://github.com/facebook/augmented-traffic-control
他们还为此写了一篇博客:https://code.facebook.com/posts/1561127100804165/augmented-traffic-control-a-tool-to-simulate-network-conditions/