The question is pretty straight forward, How do I find out how much mobile data (in GB or MB) has the user used in the current month?
As it has been reported as off topic, I want to clarify that the data usage is supposed to be checked via code in an app.
Is there some code I can use to check for the users used data?
Check Data Usage From an Android Device To check your current month's usage on your Android phone, go to Settings > Connections > Data Usage. The screen shows your billing period and the amount of cellular data you've used so far. You can also set a mobile data limit on this screen.
See: https://developer.android.com/reference/android/net/TrafficStats.html
Try:
Toast.makeText(this, android.net.TrafficStats.getMobileRxBytes()+"Bytes", Toast.LENGTH_SHORT).show();
getMobileRxBytes() Return number of bytes received across mobile networks since device boot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With