DEV Community

Roel Hogervorst
Roel Hogervorst

Posted on • Originally published at on

Logging my phone use with tasker

In this post I’ll show you how I logged my phone use with tasker, in a followup post I’ll show you how I visualized that.

I had a great vacation last week but relaxing in Spain I thought about myuse of technology and became a bit concerned with how manytimes I actually look at my phone.

But how many times a day do I actually look at my phone?I used the android app taskerI bought and have used the app before, but I never really bothered to figurethe app out. I did now.

Tasker can be used to automate many things in your phone, for instance turn onwifi when you’re near a certain place, dim screen when it’s late, mute the phonewhen you’re in a meeting and many more things.

But in this case I wanted a simple way to track my phone use, as a proxy forphone use I have a counter that starts every day at 0 and increments with oneeverytime the screen is on.

How to do that:

  • In Profiles, create a new profile, with state: ‘Display State On’, give it a useful name f.i.: ‘screen counter’
  • Then add a task, give that a name too, f.i. : ‘update screen count’

That task has multiple actions, I set mine up to

  • wait for 4 seconds (a quick on and off does not count)
  • Variable add ‘%SCREEN_COUNT’ value 1, wrap around 0
  • if you want to, you could flash a message
  • write file, give it a name, f.i. ‘screenlog.csv’ and create some text to write to that file. I used “screenlog”;“%DATE”;“%TIME”;“%SCREEN_COUNT” and toggle append and add newline

This way the file gets appended with new screen counts everytime I open the phone,the resulting file is a ‘;’ - seperated file where tasker replaces the %DATE etc with the current valuesSo today it would write


Enter fullscreen mode Exit fullscreen mode

For some reason the app sometimes writes in USA style date and sometimes in normalday-month-year style, so that gives me head aches, but it works reasonably well.

How to reset the counter?

I set up a new profile for that reason.Every day in the final minutes of the day a new task is run that resets the $SCREEN_COUNT to 0.

Top comments (0)