Mobile data usage

Post your questions and help other users.

Moderator: Martin

Post Reply
Luca.Biraghi
Posts: 10
Joined: 19 Feb 2017 12:20

Mobile data usage

Post by Luca.Biraghi » 21 Oct 2018 13:35

Hello Martin!
I write to ask a question.
I've already built a flow to monitor and show in notification my mobile data usage but, having shifted to an operator that resets his plan every month on the same day, I'd like to build a simpler flow.
For the one I use now, I use Init network traffic variable. My question is: considering that android 6 already keeps track of the mobile data used on a month cycle and show the number that I want (see the attached picture), is there a way to initialize "that" number? It's already calculated and it would not be necessary to do all the maths to update the network value and all the other stuff to get the used data.
Thanks for helping,

Luca
Attachments
20181021_152420.png
20181021_152420.png (310.99 KiB) Viewed 7250 times

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Mobile data usage

Post by Martin » 21 Oct 2018 18:18

Hi,

Action Init Variable Network Statistics queries the data recorded by the system and should work on Android 6+.

Regards,
Martin

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Mobile data usage

Post by Desmanto » 21 Oct 2018 18:20

AFAIK, there is no way to clear/reset that data usage statistic using standard API. You have to use root and delete the /data/system/netstats to reset it. Be careful, deleting wrong files can cause havoc to your phone. So make sure you know the risk you are facing.

Better just make you own calculation at the beginning of the new period. You can store the starting point of the statitic to a glovar or text file.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply