Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I would like to test my application for cases of low network connectivity. Except standing in the elevator, what is the best way to do this? I've tried wrapping my phone in an aluminum foil, but it didn't help much.
I need to test it on a real device, not in an emulator.
This may sound a little crazy, but a microwave oven serves as a microwave shield. Therefore, putting your device inside a microwave oven (DO NOT turn on the microwave oven while your device is inside!) will cause your signal strength to drop significantly. It definitely beats standing inside an elevator...
You can use emulator for this. Take a look at this page: Android Emulator. Pay attention to next two arguments:
-netdelay <delay>
Set network latency emulation to . Default value is none. See
the table in Network Delay Emulation for supported values.
-netspeed <speed>
Set network speed emulation to . Default value is full. See
the table in Network Speed Emulation for supported values.
Speeds for reference in increasing kbps:
UP DOWN
-------- ----------
gsm GSM/CSD 14.4 14.4
hscsd HSCSD 14.4 57.6
gprs GPRS 28.8 57.6
umts UMTS/3G 384.0 384.0
edge EDGE/EGPRS 473.6 473.6
hsdpa HSDPA 5760.0 13,980.0
lte LTE 58,000.0 173,000.0
evdo EVDO 75,000.0 280,000.0
full No limit ∞ ∞
Since iPhones developer option apply on wifi tethering, you can get an iPhone which has iOS 6 and above (and has been set to use for developments with the xcode), set it to emulate the desired network profile, connect your Android device to its hotspot
Update for Android Studio v 1.5 or greater
As #LouMorda mentioned in a comment below that the Emulator tab mentioned in original post has been removed in Android Studio v 1.5.
Now They've placed these settings in Simulator Settings in AVD Manager.
To access these settings:
Select Tools -> Android -> AVD Manager
Click the Edit AVD button (pencil icon)
The Network Settings can be accessed after clicking the Show Advanced Settings button
Here is a screenshot of how it may appear:
Original Post
For anyone using Android Studio IDE:
Go to Run -> Edit Configurations
Select Android Application -> [Your App]
Select Emulator tab
Here you can change different values for Network Speed(internet speed) and Network Latency (delay) to simulate different speeds and latencies etc
Alternatively, you can enter various arguments in Additional command line options text field as mentioned in #inazaruk's answer.
The screenshot below describes how this Run Configuration screen looks like:
I know its a bit late to answer to this question, but i hope this helps others facing similar issues!
Edit
For anyone using eclipse, see #Abhi's answer below.
I know it's an old question but...
Some phones nowadays have a setting to utilize 2G only. It's perfect for simulating slow internet on a real device.
Years old but hey, I'll chime in with my foolproof method with Genymotion.
Download the Charles free trial: http://www.charlesproxy.com/download/
Install it
ClickProxy -> Throttle Settings
Set up your HTTP throttled speeds
Close that window
Click Proxy -> Throttling to enable the throttle
Open up a Genymotion emulator
Open the wifi settings
Long press the enabled wifi connection
Click Modify Network
Click Show Advanced Options
Set Proxy to Manual
Set the Proxy hostname to 10.0.3.2
Set the Port to 8888
Click Save
And now your network will be throttled!
I have one strategy to settle your problem. You can use the application of proxy to modify or monitor your net status. e.g, Charles.
You ought to change the default config of the Charles like the following picture I posted.
And finally, you will discover the net status has been shaped into lower pace.
You are also able to test slow internet connectivity on an real android device:
Tested with Samsung Galaxy S8 + Android 8.0.0
Go to Settings -> Connection -> Mobile Network -> and under networkmode you can choose to only use 2G or 3G connections
In Android Studio, while running an emulator:
1- Hit settings button at the bottom of the emulator sidebar
2- Go to Cellular
3- Set Network Type
Easy way to test your application with low/bad connection in emulator:
Go Run > Run configurations, select your Android Application, and there go to Target tab.
Look Emulator launch parameters. Here, you can easy modify Network Speed and Network Latency.
There's a simple way of testing low speeds on a real device that seems to have been overlooked. It does require a Mac and an ethernet (or other wired) network connection.
Turn on Wifi sharing on the Mac, turning your computer into a Wifi hotspot, connect your device to this. Use Netlimiter/Charles Proxy or Network Link Conditioner (which you may have already installed) to control the speeds.
For more details and to understand what sort of speeds you should test on check out: http://opensignal.com/blog/2016/02/05/go-slow-how-why-to-test-apps-on-poor-connections/
I'm surprised nobody mentioned this. You can tether via Bluetooth, and separate them by ten+ meters(or less with obstacles). You've got a real bad connection. No microwave, no elevator, no software needed.
Or on an actual device you can go to Settings -> Mobile Networks -> Preferred network types and chose the slowest available...
Of course this is very limited, but for some test- purposes it might be enough.
Facebook built something called Augmented Traffic Control. A brief summary from their GitHub page:
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.
You can find it here on GitHub: https://github.com/facebook/augmented-traffic-control
They have also written a blog post about it: https://code.facebook.com/posts/1561127100804165/augmented-traffic-control-a-tool-to-simulate-network-conditions/
UPDATE on the Android studio AVD:
open AVD manager
create/edit AVD
click advanced settings
select your preferred connectivity setting
No microwaves or elevators :)
for and mac OS user you can use Network Link Conditioner which could be downloaded from apple. set it as a AP on mac and any divices could connected it.
you can either use facebook open source tools ATC
http://facebook.github.io/augmented-traffic-control/
Go Run > Run configurations, select your Android Application, and there go to Target tab. Do changes as shown in the figure.
I was struggling with this problem for half a day, finally I came to this solution:
Testing on a real device doesn't make much sense overall as you have to go through a lot to make it work. The only logical way to achieve real testing is to make your phone connect to a low quality cellular network, like EDGE, if your phone company provides it. You can try to do this by dialing *#*#4636#*#* in the phone app
The original Android emulator is way too slow for testing and doesn't achieve more than the solution above.
The best way to do this is using Genymotion. It's an Android emulator with much better performance than the original AVDs and the version for personal use is free.
After you created your virtual device in Genymotion, just go through this tutorial to set a proxy for the device.
Run a proxy server on your host machine that simulates bad network conditions, like Crapify or Toxiproxy (I only tested the former) and you're good to go.
Update:
I just realized you can pick the very same strategy with real devices too. I feel like an idiot for not realizing it sooner. Just start a Crapify proxy on your computer, set your phone proxy to your computer's local address and voila, you've got crappy internet on your phone.
Do you want to test for no network connection, or just a slow network connection? If the former, you can go to Settings > Wireless & networks > Airplane mode and turn Airplane mode on. That will let you test network unavailability on an actual device.
as suggested by #VicVu Charles (or any other proxy tool) is an easier way to go. But I would Like to add that you can do this with your device also, not just genymotion or other emulators. Process will be the same:
Modify your device/emulator's wifi setting to use manual proxy. And then Set the Proxy hostname & port
a. set the hostname as ip of your system (get the ip of your pc/mac using ifconfig/ifconfig)
b. set the port number of genymotion (check the proxy settings in charles)
PS: Your device/emulator MUST be using the same wifi since the ip you are using will most probably be the private ip.
Open terminal inAndroid Studio and Go to ../../Android/sdk/tools. 'emulator' executable should be available here.
Run ./emulator -netdelay "delay_in_millis" -avd "emulator_device_name"
Ex: ./emulator -netdelay 60000 -avd Nexus_5_API_21
Now build your app and install it in emulator.
Run your scenario in app.
Make sure you have your code changes in app that sets timeout to your request and handles that.
Just go to Android device monitor from Android studio , then DDMS -> Emulator Control.There will be Speed and Latency properties.
I found netlimiter4 to be the best solution for throttling data to emulators.
It provides for granular control through a decent gui and gives you graphical feedback on the data throughput to each process. Currently in a free beta.
screenshot
http://www.netlimiter.com/products/nl4
There are apps available on the play store to throttle to actual devices but they require root(I cant provide any advice as to how well they work, if at at all - YMMV.)
search for bradybound on the play store, I can't post more than one link..
have you tried this?
Settings - Networks - More - Mobile Networks - Network mode - Select preferred network (2G for example).
Another method i used was mentioned above. Connect via iPhone hot spot.
Hope this helps.
I'm using mitmproxy HTTPS proxy. https://mitmproxy.org/
Mitmproxy is an open source proxy application that allows intercepting HTTP and HTTPS connections between any HTTP(S) client. It allows to monitor, capture and alter these connections in realtime. Change request, response, header, ...
Additionally you can intercept different requests.
e.g. response_delay.py:
from mitmproxy import http
from time import sleep
def response(flow: http.HTTPFlow) -> None:
sleep(5.0)
Then executing this comment delays all responses from the server:
mitmproxy --cert \*.asdf.at=./cert.pem --scripts response_delay.py
In my app I'm using certificate pinning, so you need to add the certificate (private + public)
cat private.key public.key > cert.pem
You can find a simple Tutorial here.
You can find other scripting examples here.
Very old post but I'll add my two cents. I have been VERY happy with this hardware product ( https://apposite-tech.com/products/linktropy-mini/ ) which has enabled us to simulate a lot of real-world conditions. For a long time we had challenges troubleshooting various things that would work in emulator or with airplane mode.
We have several different profiles setup from zero-connectivity to various stages of marginal connectivity, with different degrees of latency, packet loss, and bit-errors. The great thing about it is we can change these on the fly without having to relaunch the app in an emulator. The price has been entirely worth it for our shop, and it's dead simple to use.
I needed to throttle low internet on AndroidTV native device and based on what I have read, the most suitable solution was to limit the internet access directly in my router.
Go to router settings (locally it is smth like 192.168.0.1) -> set up DHCP server (if it's not running) -> choose IP address of a device and set the restriction;
Goal: Test android app on a physical device with various network connectivity issues (Offline, Slow 3G etc). Android Emulator is not an option for my use case.
Steps I have tried: (Remote Debugging)
Connect my phone to my computer and open the app on my phone.
In chrome "Remote devices" I select my phone and click on inspect for the app opened on my phone. Once the Developer Tools window opens I can play with my app from chrome.
In the network tab I can see the throttling options but when I try the offline option or any other option to slow down the network it does not seem to work.
The offline/slow 3G option works for a normal website but not when using remote devices. I wanted to see if anyone has tried this option before and if it worked for them and I would appreciate suggestions for better alternatives to test an android app with various network settings other than using chrome remote devices?
Other options I have come across are installing a proxy app on PC/Mac and configure networking throttling in the app and then create a wifi hotspot and connect my phone with it. This is possible but it would be tricky with the tools we use so I was looking for a more elegant solution.
The "remote devices" of chrome won't affect your native app. It will not even affect another opened tab other than the one you are "inspecting" and throttling. If you really need to throttle your device's network connection you should use a proxy. A good and easy to handle proxy is Charles web debugging. The free version will cover your needs if you are willing to reconnect every 30 mins. But for sure I recommend you purchase a license since this tool will be always helpful and developers also need to make a living ;)
Here is an example of setting up Charles as a proxy for an android device.
It's a little unclear from your question, but I'm assuming that you're using Remote Debugging to run a webpage on an Android device, and you want to profile the webpage from a laptop/desktop connected to the Android.
One workaround is to use https://www.webpagetest.org/easy. This actually runs your webpage on a real Motorola G device in Virginia with a Slow 3G connection. It gives you a detailed report on your loading performance, just like the DevTools Performance panel.
One of the DevTools team members said that Remote Debugging + Network Throttling should work, but neither of us has tried it recently.
This is a doozy. Will try and make it short and sweet.
Hitting the same web URL, my desktop computer reports SSL errors for many sites. HTTPS with a red line strike through and red padlocks in descriptions.
My mobile phone does not, on wifi or mobile network. My remote computer in a remote location does not. Green padlocks for all.
Chrome browser is up to date and latest (Version 47.0.2526.106 m) across all browsers. Extensions are identical across local and remote desktop.
I cannot for the life of me figure out what is loading up on my desktop at home that isn't loading up on my remote desktop at my moms. Both machines are on Win7 64 bit. Both chrome browsers are same version, same extensions running. Recently 'reset' chrome on my home desktop to try and fix. Worked first time, but problem came back. Second time it didn't do anything. Very random. Somedays i'll get green padlocks, somedays i get red ones. The intermittent nature of this has me dumbfounded. Also, all of the browsers actually state the info about an obsolete cipher, but only my desktop deems it to be redlock worthy. It also claims there are other insecure resources on the page, but my remote desktop and mobile device don't see them. wth?!?!
Should i completely remove chrome and reinstall it from scratch? Since i already used the 'Restore settings to their original defaults.' button in the settings.. this doesn't seem like it would cure it.
One other aspect i haven't been able to determine is whether my computer being hardwired into a TL-WPA4220 WiFi Powerline Extender is the culprit. Does the fact the extender/repeater not a direct connection to my router have anything to do with this? Altho my mobile phone is connected to that wifi access point and it shows a green padlock on the same sites so....
I am currently running a virus scan as we speak.
Any guesses? Thanks in advance.
Attached pics.
home desktop | remote desktop
if you look at the dialog at the home desktop closely you will see
connection is not private because the site loaded an insecure script
Since you don't see the message at the remote desktop it is very likely that a locally installed browser extension causes this problem. Thus check your extension, disable them and retry.
I figured it out after thinking long and hard about the differences between computers. Ultimately i realized that all the working browsers were either fresh installs, or browsers that didn't have my user account connected and synced through it.
I ultimately went to Settings > Sign In / Disconnect your Google Account... and made sure all cookies/data for the local device were removed. Then i did a full browser 'Reset'.
Once i had the default standard page asking me to sign it, i tested the offending page. It showed up with a green padlock. I tested other offending bank sites as well. All green.
From there i closed the browser and restarted it, and when presented with the page to log into my google account, it resynced all my bookmarks/toolbars/extensions.
And still all green padlocks. Hopefully this is a permanent fix but for now it's all holding well. I also got slightly more updated to Chrome Version 47.0.2526.111 m.
My assumption here is that somewhere between the time i first synced my chrome to my google account years ago on this computer, whatever version it was then (42,45,who knows) that one of the updates to chrome didn't take well on my desktop and was creating conflicts only on this computer under this local profile. No amount of clearing cookies or resetting the browser could fix it. Fully disconnecting my account and re-syncing my chrome to my google account is what fixed the HTTPS / SSL padlock problems.
Not sure if this will help anyone, seems i was the only one on the internet with this problem. :P
Mozzila decided they don't need error console in their mobile browser, so they instead invented "Remote debugging", something that would probably be cool if it ever worked. I tried it few times before just for fun, but never got it to connect. Now I really needed and I was also expecting the feature improved over time. Not at all.
Enable on Mobile
To enable remote debugging, you're first supposed to allow USB debugging and then remote debugging in Firefox Mobile. These are just two buttons, so it's no problem. My Firefox Mobile version is 39.0.
Enable in browser
In browser, as I understand it, WebIDE is used, which is a special Firefox debugger and virtualiser. Can be launched using Shift+F8. The connected USB device is supposed to appear in menu:
I was wondering why I see Install ADB Helper in menu when it's already installed. It's probably because this:
I guess Firefox hates me.
The question
Since Mozzila obviously disabled their only means of debugging mobile Firefox, I came here to ask for some workaround. With all those mobile web pages I expect lot of you guys know how to debug them. Possible solutions I'm looking for:
Debug over IP instead of USB. I am much more comfortable with using WiFi than USB.
Force Firefox to enable ADB Helper even though it's incompatible.
To get ADB Helper working, update your Firefox desktop version. It looks like you're on 37, which is unsupported, insecure, and ~6 months out of date.
Wi-Fi Debugging landed in Firefox 42: https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Debugging_Firefox_for_Android_over_Wifi
I have a website which I hot on WinHost.com. In the past few weeks, I have found that 80% of the time, a page stalls while loading. That is, it never loads. It just sits there trying to load.
This issue never happens on my PC.
It does however, happen on my wife's phone too (Same network provider).
We both use Chrome, but it happens on all browsers.
I found a 'Phone Emulator' site, and have no such problems. It seems to load the mobile version fine. It only happens on my, and my wife's phone. The site is in development, so we're the only users.
Is there a way I can debug what is happening, on my phone? Like in the Desktop version of Chrome, I can F12 and see what's happening?
The site runs Asp.Net MVC4, with a Twitter Bootstrap UI.
Sure you can do it by using the latest version of Chrome.
https://developer.chrome.com/devtools/docs/remote-debugging
After connecting, just open the Inspector tool, and select Network tab in PC, reload the page to see what happen.
I found the easiest way was to share my phones internet connection, tether my laptop to it, and run Chrome, pressing F12 to get the network traffic.