14

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?

5
  • @ModularSynth no, it's not. sorry didn't explained well. I need to do it via code in an app of course
    – Daniele C
    Commented Sep 3, 2017 at 16:23
  • 2
    Guys this question isn't off topic at all. He explained it so why all this downvotes?
    – Daniele
    Commented Sep 3, 2017 at 16:28
  • 2
    Asking for a tutorial is actually very off-topic, here. Commented Sep 3, 2017 at 16:40
  • 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.
    – Mukesh M
    Commented Sep 3, 2017 at 16:53

1 Answer 1

12

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.

1
  • In my Galaxy note 10 (2022), I get 0 from this. Commented Sep 10, 2022 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.