Questions tagged [usageevents]

8 questions
2
votes
2 answers

How to track app usage time programmatically in android?

I want to know how much time user is using my app . So whenever he opens my app I want to know time and whenever he close app i want to know time. When user will close app i want to send usage time to server. How can i track usage time in android ?
Mahesh
  • 287
  • 4
  • 11
1
vote
1 answer

queryEvents call returns nothing

I'm sorry if this is a repeat post, but I've looked at several questions and none of them seem to help me. So, I'm trying to call queryEvents() but I get nothing. I'm attaching my code here, would appreciate if anyone can point out what I'm missing.…
droid_dev
  • 303
  • 4
  • 15
1
vote
1 answer

on Android UsageEvents.Event getClass().getName() returns only android.app.usage.UsageEvents$Event and not the name

I'm trying to get the usage on my Android app. Android offers a package to get that info. To get the events, I need to set a time and retrieve a list of events from different apps, I'm only interested on the events from my own app. UsageStatsManager…
FeanDoe
  • 1,608
  • 1
  • 18
  • 30
1
vote
1 answer

Count how many times every app is used in one day using UsageEvents, UsageEvents.Event and MOVE_TO_FOREGROUND

With UsageStatsManager and UsageStats I'm able to obtain the daily usage (in hours, minutes and seconds) of every app on my smartphone. Now I want to know if there is a way to obtain the daily frequency of use (in numbers of times, i.e. 1 time, 2…
Fobi
  • 435
  • 1
  • 7
  • 17
0
votes
0 answers

I try to get background app package name using foreground service with UsageEvent in android 12

long endTime = System.currentTimeMillis(); long beginTime = endTime - 10000; String result = ""; UsageEvents.Event event = new UsageEvents.Event(); UsageEvents usageEvents = sUsageStatsManager.queryEvents(beginTime,…
0
votes
1 answer

disable app usage tracking temporily

I am using UsageStatsManager to get the history of app usage records in a particular day. The problem I have been facing is, for example, when user opens Facebook at 1:00pm, and at 1:01pm, he locks the screen, with facebook still in foreground, and…
0
votes
1 answer

UsageStatsManager method 'queryEvents' does not return more than one week old dates

UsageStatsManager manager = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE); UsageEvents events = manager.queryEvents(range[0], range[1]); //range[0] is 25th April,2018 converted in long, and range[1] is May 25,2018 in…
MrRobot9
  • 2,402
  • 4
  • 31
  • 68
0
votes
0 answers

How many time access to email app

I need to know from my app how many times in a day I access to email app, and I need to know when I launch email app. I have found usage stat and event usage, but any solution allowed me to solve my problem. Thanks
user6763460