App usage time tracker

Share and discuss your flows and ideas with other users.

Moderator: Martin

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

App usage time tracker

Post by vamzicool » 18 May 2016 08:39

Since I wanted to know how much time I spent on any app one my phone I created these two flows and on widget. "App task started" flow logs the time the app was launched. "App task ended" flow logs the time the respective app was dismissed. It also calculates the duration the app was used. The app usage widget is used to display the top ten used apps. It has clickable actions . Top most portion of the widget when clicked resets the app usage data. Bottom portion when clicked display the current app usage times. Please note that the duration of app usage is not calculated if the app is running in the background. Here are the flows and widget :

http://automagic4android.com/flow.php?i ... a8132da742

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: App usage time tracker

Post by vamzicool » 26 May 2016 07:13

Updated flows which includes top 15 apps that is used the most. Widget image attached here.

http://automagic4android.com/flow.php?i ... f00d59ff6f

Aside : Since I have a list of excluded apps , my script logic loops through the top 15 apps and also removes the excluded apps which results in the widget showing less than 15 apps. In scripting, wish there was removeMapEntries function to remove all the other apps other than the top 15 so that I didnt have to loop through apps. removeMapEntry doesn't seem to work.
Attachments
Screenshot_2016-05-26-12-25-07.png
Screenshot_2016-05-26-12-25-07.png (808.43 KiB) Viewed 16698 times

User avatar
Bushmills
Posts: 286
Joined: 23 Sep 2014 21:56

Re: App usage time tracker

Post by Bushmills » 26 May 2016 09:12

Have you considered using Gleeo or another time/event tracker to do the actual calculation - and possibly visualisation -, and let the flow simply start/stop activity recording?

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: App usage time tracker

Post by vamzicool » 26 May 2016 13:15

@Bushmills thank you for your suggestion. I tried gleeo with automagic but sadly it doesn't record app usage intervals in seconds.

Claas
Posts: 12
Joined: 06 Aug 2015 17:42

Re: App usage time tracker

Post by Claas » 27 May 2016 20:16

What exactly do i have to do after activating the flows and placing the widget?

...did it and it keeps showing me whats on the screenshot - i feel dumb =)

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: App usage time tracker

Post by vamzicool » 28 May 2016 09:06

@Claas the widget has two clickable actions, top and bottom click. if you click the top portion of the widget, it resets the app usage data. If you click the bottom portion of the widget, it refreshes and shows the latest app usage data. For the widget to show any new data, you have to click the bottom portion anytime you need the latest app usage data. I hope this helps....

Note : After clicking the top portion, click the bottom portion only after using some apps as this widget needs some app usage data to be displayed. Otherwise you may get error message.

Claas
Posts: 12
Joined: 06 Aug 2015 17:42

Re: App usage time tracker

Post by Claas » 28 May 2016 21:17

When I click on top nothing happens and bottom always brings up an error message

Log files are too much for me =)

28.05.2016 23:16:10.005 [Clickable WidgetApp usage] Start executing action 'Script: Show app usage'
28.05.2016 23:16:10.032 [Clickable WidgetApp usage] Action 'Script: Show app usage'
ch.gridvision.ppam.androidautomagic.simplelang.a.d: Error while calling function getElement (Expression: getElement(apps, i)[line 11], Cause: Invalid index 0, size is 0)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:736)
at ch.gridvision.ppam.androidautomagic.simplelang.c.ah.b(SourceFile:49)
at ch.gridvision.ppam.androidautomagic.simplelang.c.b.a(SourceFile:40)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:109)
at ch.gridvision.ppam.androidautomagic.simplelang.c.w.b(SourceFile:25)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:396)
at ch.gridvision.ppam.androidautomagic.simplelang.c.d.b(SourceFile:22)
at ch.gridvision.ppam.androidautomagic.simplelang.c.b.a(SourceFile:40)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:109)
at ch.gridvision.ppam.androidautomagic.simplelang.c.w.b(SourceFile:25)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:803)
at ch.gridvision.ppam.androidautomagic.simplelang.c.y.b(SourceFile:42)
at ch.gridvision.ppam.androidautomagic.simplelang.c.b.a(SourceFile:40)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:144)
at ch.gridvision.ppam.androidautomagic.simplelang.c.ac.b(SourceFile:23)
at ch.gridvision.ppam.androidautomagic.simplelang.c.b.a(SourceFile:40)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:109)
at ch.gridvision.ppam.androidautomagic.simplelang.c.w.b(SourceFile:25)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:886)
at ch.gridvision.ppam.androidautomagic.simplelang.c.ab.b(SourceFile:78)
at ch.gridvision.ppam.androidautomagic.simplelang.c.b.a(SourceFile:40)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:109)
at ch.gridvision.ppam.androidautomagic.simplelang.c.w.b(SourceFile:25)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:803)
at ch.gridvision.ppam.androidautomagic.simplelang.c.y.b(SourceFile:42)
at ch.gridvision.ppam.androidautomagic.simplelang.c.b.a(SourceFile:40)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:116)
at ch.gridvision.ppam.androidautomagic.simplelang.c.am.b(SourceFile:33)
at ch.gridvision.ppam.androidautomagic.simplelang.a.k.a(SourceFile:836)
at ch.gridvision.ppam.androidautomagic.simplelang.a.k.a(SourceFile:817)
at ch.gridvision.ppam.androidautomagic.c.a.et$1.d(SourceFile:119)
at ch.gridvision.ppam.androidautomagic.c.a.et$1.a(SourceFile:110)
at ch.gridvision.ppam.androidautomagiclib.util.dj$1.run(SourceFile:39)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.get(ArrayList.java:308)
at ch.gridvision.ppam.androidautomagic.simplelang.a.c.a(SourceFile:1983)
at ch.gridvision.ppam.androidautomagic.simplelang.a.b.a(SourceFile:728)
... 33 more

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: App usage time tracker

Post by vamzicool » 29 May 2016 13:40

Note : After clicking the top portion, click the bottom portion only after using some apps as this widget needs some app usage data to be displayed. Otherwise you may get error message.

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: App usage time tracker

Post by MURTUMA » 29 May 2016 14:19

@vamzicool: You should propably replace the "Show app usage" script action with an actual flow, which contains the said script. That way you could properly handle the error message with exception line. I would show something like "not enough statistics gathered" in the widget when the exception occurs.

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: App usage time tracker

Post by vamzicool » 29 May 2016 15:09

@MURTUMA thank you for your suggestion. That's a good way to handle that error.

Post Reply