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):
- Find an app that accesses/uses the Apple data - does this even exist for developers? - and that exposes this data to Shortcuts
- 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