How to limit/throttle WiFi data speed on my Android device? I am testing an Android application and need to understand how does the app behave on different internet speeds.
An example of test case is: 
1. set the maximum bandwidth to 20kbps and check how it works;
2. set the maximum bandwidth to 50kbps and check how it works... etc.

The problem is - I have no idea how to limit the traffic.

I am using WiFi and Charles Proxy. I use Charles to check how does the app reacts. Unfortunately, I am unable to throttle using Charles - for some reason Charles limits do not affect my app at all.

Anyway, can somebody assist me with this problem? Do you have any ideas on how to limit the bandwidth?

Thanks in advance.
FOR ROOTED DEVICE
(copied from Mansour's answer on this post)

Checkout BradyBound. It's a system wide download speed shaper/limiter. Few things to note:

The app requires root access.
It works by dropping packets using iptables. This wastes some traffic - how much depends on the type of traffic (e.g. long running download, web browsing).
Rate measurement is done by number of packets instead of bytes so the speed limit won't be accurate.
This only limits TCP traffic (it makes no sense to drop UDP packets).

Note also that I'm the author of this app.

Edit #1:
Explanation:
Data is divided into small parts called Packets to be transmitted across the network.
It can be transmitted using TCP (Transmission Control Protocol) or UDP (User Datagram Protocol)
Let's take an example:
Suppose you are the server and I am the host and I want to download a file, so first I will send you a request for it, after which you will process, and instead of sending the whole file, you will divide the large file in small packets.
Now each packet that has been created will contain information like source IP (yours) and destination IP (mine), along with some additional data (sequence no., data size, time to live, etc.)
You will send those packets and they can reach me via routers.
It is not necessary that all the packets have to come to me via the same route.
They can come to me via different available routes.
When they reach me, TCP/UDP comes in picture.
If you have used TCP for transmission, when a packet reaches me, an acknowledgement stating that the packet reached me is sent back to you.
This feature is lacking in UDP. If you have used UDP, unlike TCP, it doesn't send acknowledgements to you. That means you, as a server, have no idea whether packets are reaching me or not.
In case it is lost in transmission, it is lost forever.
Dropping Packets
Dropping packets means discarding packets.
So basically, when I will drop the packet sent by you, an acknowledgement will be sent to you (in the case of TCP) that the packet was lost in transmission, so you will have to send it again.
In this way, it wastes traffic and limits speed at the same time I get the whole file.
If I will drop UDP packets, I will not receive the whole file.
That's the reason the app doesn't control UDP traffic.
And yes, root privilege is a must, since iptable can be accessed with superuser access only.