I am searching for an API which could limit the internet download speed by lowering the bandwidth of the connection. Is it possible to do this without root privileges android?
Asked
Active
Viewed 2,113 times
1
-
see this link https://stackoverflow.com/questions/24366016/how-to-get-programmatically-the-data-usage-limit-set-by-user-on-android-os-confi – Satyavrat Jun 22 '17 at 11:00
-
@Satyavrat Thanks but I need to work with network's bandwidth. Something like an app in play store, by name "Brandy bound". but without "su" commands. Is there any API from google or any other source[except for rooting]? – Jun 22 '17 at 11:26
1 Answers
0
you can get limitBytes and warningBytes by the following code, if you can use android.permission.MANAGE_NETWORK_POLICY
and android.permission.READ_PHONE_STATE
.
However, the protection level of android.permission.MANAGE_NETWORK_POLICY
is signature.
NetworkPolicyManager manager = (NetworkPolicyManager) getSystemService("netpolicy");
NetworkPolicy[] networkPolicies = manager.getNetworkPolicies();
Log.d("NetworkPolicy", "limitBytes is " + networkPolicies[0].limitBytes);
Log.d("NetworkPolicy", "warningBytes is " + networkPolicies[0].warningBytes);
(NetworkPolicyManager and NetworkPolicy classes are hidden classes)
-
How do I acces those hidden classes with reflection. Give a little hint please. Thank you. – Jun 23 '17 at 09:32
-
-