Open ohhai opened 2 years ago
I see, and I was already thinking of adding the option to export the (SQLite) database. Of course, a CSV export is also possible, and it's probably the more useful format for most people.
The data is currently stored in rows with a _from
and a _to
column of the type TIMESTAMP
. So a direct export would look more like this:
_from;_to
1655323662;1655323667
Would that still be useful for you?
Although it's likely that I will need to change the type of these fields in the near future, because Unix timestamp don't go well with DST changes and things like that 😬 Working with dates (and times) is really hard 😉 So I might change the type to a proper DATETIME
field, which would change the export too, of course.
Ultimately it's probably:
_from;_to
"Mi 15 Jun 2022 22:07:42";"Mi 15 Jun 2022 22:07:47"
And maybe it's even necessary to add a timezone too 🤔
About the notification and the "running in the background", these are actually closely related. Android's battery optimization doesn't allow apps to run silently in the background. There are exceptions, of course, but the recommended behavior for apps that should be kept running is to show an ongoing foreground notification. This should make it clear to the user that the app is constantly running.
Which is fine for this app because I wanted to have a permanent notification anyway 😉 What doesn't mean this app is doing any work in the background. It's only ever active (and using energy) when you unlock your device.
Would that still be useful for you?
Sure, it's still useful. Usually I use Linux shell and date
utility for timestamps formatting.
date
understands wide variety of input data, your example is correct input for it:
$ date --date="15 Jun 2022 22:07:47"
Wed Jun 15 22:07:47 EEST 2022
Some related ISO/RFC standards are mentioned in its docs: https://man7.org/linux/man-pages/man1/date.1.html
More common ways for date formatting might be MS Office Excel, Libreoffice Calc and Google spreadsheets, I believe they should have functions for date conversion.
As for Unix timestamp, I'm not an expert, just thought it's OK with timezones, like unixtime 0
always means fixed moment of "00:00:00 UTC on 1 January 1970" and then it just adds time shift from this moment. However after more reading I see that unixtime format has "leap second" problem at least. So any fixed widespread format should be OK if it could be understood and converted by software mentioned above.
Thank you for explanations about work in background, it's always a concern for battery-powered device. It's still a question for me why Android tells me about idle Screen Time but keeps silence about apps which send me own notifications (so, are active for sure) from background. This extra notification is distracting, I'll try to do something with it.
Hi, I would also like to have the possibility to export the ScreeTime data as e.g. CSV to keep on track of my screen time over a longer period of time. I'm open for any solution :smiley:
PS: Thanks a lot for this great app with it's outstanding simplicity!
please allow exporting the database, I couldn't figure out how to do it with adb
Version 1.2.0 does support exporting/importing the SQLite database now: https://github.com/markusfisch/ScreenTime/releases/tag/1.2.0
Should also be available on Google Play already.
Why I'm asking for this: I look for phone app for automatic sleep tracking. Easiest way is to define sleep as longest time of screen turned off. Existing sleep trackers usually require manual start/stop and are overbloated for such a simple purpose. Same for phone activity trackers - they usually include apps usage analytics, time warnings, blocking of overusage, etc. So you app is very close to a perfect match. Anyone can easily implement any analyzing logic, charts and statistics in a spreadsheet table basing on data from Screen Time.
CSV seems to be an optimal export format, containing just event and its timestamp. The latter might be Unixtime, easiest to do computations with it. So it might be like following:
Additional dependency is to save history log for a long time, it is not preserved for now, as far as I see.
I believe all of that should add small overhead to code and UI (just one "export" button).
Couple of unrelated things, I can create separate issues for them if necessary:
1) As far as I see, there is no option to disable notification from Screen Time. I did it in Android system settings, but some people might miss this way. 2) I have "Screen Time is running in background" system notification on Android 8. Not sure why it appears since a lot of apps are working in background without this notification.
Paid version with that features is also an option, especially taking into account it's opensource 👍