我想测试我的应用程序的低网络连接的情况。除了站在电梯里,还有什么最好的方法呢?我试过用铝箔纸包我的手机,但没有用。

我需要在真正的设备上测试它,而不是在模拟器上。


当前回答

对于mac操作系统用户,你可以使用网络链接调节器,可以从苹果下载。将其设置为mac上的AP,任何设备都可以连接它。

你可以使用facebook的开源工具ATC http://facebook.github.io/augmented-traffic-control/

其他回答

在Android Studio中打开终端,进入../../Android/sdk/tools。'模拟器'可执行文件应该在这里可用。 运行。/emulator -netdelay "delay_in_millis" -avd "emulator_device_name" 例如:./emulator -netdelay 60000 -avd Nexus_5_API_21 现在构建应用程序并将其安装在模拟器中。 在应用程序中运行您的场景。

确保你有你的代码变化在应用程序设置超时你的请求和处理。

我知道这是个老问题,但是…

现在有些手机的设置是只使用2G。它非常适合在真实设备上模拟慢速互联网。

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/

这听起来可能有点疯狂,但微波炉是作为微波屏蔽的。因此,把你的设备放在微波炉里(当你的设备在里面的时候不要打开微波炉!)会导致你的信号强度显著下降。这绝对比站在电梯里强……

对于mac操作系统用户,你可以使用网络链接调节器,可以从苹果下载。将其设置为mac上的AP,任何设备都可以连接它。

你可以使用facebook的开源工具ATC http://facebook.github.io/augmented-traffic-control/