Monitor cellular data usage

Hello fellow automators,

I’m interested in a way of automating the logging of my cellular data usage (including any roaming) on a monthly basis on iOS.

At the moment, and for the last few years, I’ve had a recurring OmniFocus reminder on my contract renewal date. I tap Settings → Mobile Data, mentally note the values, and then swipe back to OmniFocus where I use a TextExpander shortcut for the date and type the data manually, before swiping back, scrolling to the bottom of the list of apps, and hitting Reset Statistics.

That results in a series of entries on the OmniFocus task as follows:

2018-06-08 - 5.7GB
2018-07-09 - 6.3GB (2.2GB roaming)
2018-08-08 - 7GB (632MB roaming)
2018-09-08 - 5.5GB

It works… but it isn’t ideal. I have to manually tap through it, and occasionally I forget to reset the data.

I’d love something fully automated, but Shortcuts doesn’t provide a way of getting the current data usage or resetting it.

In the absence of that, I see two options (assuming I want to use the built in Apple data, rather than a third party logging tool that collects its own data):

  1. Find an app that accesses/uses the Apple data - does this even exist for developers? - and that exposes this data to Shortcuts
  2. Automate as much as possible of the manual workflow above.

If anyone has any suggestions for 1, let me know!

For 2, I’ve created the following proof-of-concept.

It uses the prefs:root=MOBILE_DATA_SETTINGS_ID url to launch the right section of the Settings app, and pauses for a 3 seconds to let me see the first value (the ‘Ask for Input’ action annoyingly blurs the screen too quickly otherwise). For clarity, the very first prompt in the Shortcut is just so that when it runs automatically once a month at 8am, I know what’s happening and can dismiss it if it’s not convenient - it doesn’t serve any functional purpose if you’re running it manually.

It then just echoes the values out to an alert, but in the longer term you could do whatever you want with them - log to a text file in Dropbox, row on Google Sheets or storage in DataJar, for example. It could also do with an action to return to the Settings app so you remember to Reset Statistics, which I’ve not done yet.

I’m sure there are lots of ways this could be improved. I did consider whether it would be possible to automatically capture a screenshot, crop and OCR it, for example, but (presumably for security) there isn’t a way to take a screen capture in Shortcuts. Likewise, it would be nice to scroll the Settings view to the right place to see the values clearly, or to the Reset Statistics button at the foot of the page, but I don’t think there’s a way to do this.

If anyone has any suggestions for improvements, I’d love to hear them!

All the best,
Sunil

Hi sunil, I think I have found a work around solution. I have taken what you started and found a way to automate collecting the information, although it is definitely not optimal. Please reach out.

Any particular reason not to share your work around solution here with everyone?

My workaround wasn’t designed with their intended use, but instead mine. I guess I could still share, then anyone could edit as needed. IOS-Shortcuts/Cellular Data Usage Monitor.md at main · tyshoe/IOS-Shortcuts · GitHub

I just realised that I read, but never responded to @Tyshoe’s post last August, and promptly forgot about it! I haven’t had a chance to play with your solution yet, but was reminded about this topic by some of the new the iOS17 Shortcuts actions:

  • Toggle Cellular Plan
  • Set Default Line
  • Set Data Roaming
  • Find Cellular Plans
  • Reset Cellular Data Statistics

Note: the word “Cellular” is replaced with “Mobile” if your phone is in British English.

If you use “Find Cellular Plans” you can change the returned value to be any of the following:

  • Cellular Plan
  • Label
  • Phone Number
  • Network Provider Name
  • Is Active
  • Is Default Voice Line
  • Is Current Data Line
  • Is Data Roaming Enabled
  • Name

However, and most annoyingly, there doesn’t seem to be a way of accesing the amount of data logged (either overall or roaming) for a given cellar plan. Maybe in iOS18 - perhaps someone should file a radar?

Either way, these changes are so close to allowing very easy logging of your mobile data usage within Shortcuts.