Questions tagged [usagestatsmanager]

UsageStatsManager provides access to Android device usage history and statistics. This tag is to be used with Android tag.

UsageStatsManager provides access to device usage history and statistics. Usage data is aggregated into time intervals: days, weeks, months, and years. This API requires the permission android.permission.PACKAGE_USAGE_STATS, which is a system-level permission and will not be granted to third-party apps. However, declaring the permission implies intention to use the API and the user of the device can grant permission through the Settings application.

This tag is to be used with tag.

92 questions
0
votes
1 answer

understand UsageStats and UsageStatsManager data

Anybody can help me to understand UsageStats data. What is the purpose of UsageStatsManager.INTERVAL_MONTHLY because i am getting data in day interval . Code List lUsageStatsList =…
Atul Sethi
  • 93
  • 1
  • 4
  • 11
0
votes
1 answer

How to get user typed url from browser using PACKAGE_USAGE_STATS permission?

I want to get the browser url(From all browser that is which browser using their mobile) which is typed by user on their browser. I can get that URL by using AccessibilityService. I just want to know the same how to get the url using…
karthik
  • 321
  • 1
  • 8
  • 21
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

Android - Listen for a specific application to launch and launch some other application instead

I am trying to make an application listen for a specific application (A1) to launch and then launch some other application (A2) instead (user's choice). Currently I use two permissions, PACKAGE_USAGE_STATS and BIND_ACCESSIBILITY_SERVICE. The first…
0
votes
1 answer

Unable to find Last Active Time The App Was Used

I have build an app which Launch another app called WazeApp such that if the last active time of Waze app is greater than 5 minutes then i will launch the app else i won't. here is method: /** * return true if waze was running before 5 Minutes *…
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 to get UsageStats data like this and also view like this?

*i am get some data like this * UsageStatsManager usageStatsManager = (UsageStatsManager) this.getSystemService("usagestats"); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_MONTH, -1); long start =…
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
0
votes
1 answer

How request UsageStatsManager permission like a runtime permission?

I want know if exists some solution to request UsageStatsManager permission like a normal runtime permission, where user can allow or deny the access? i not want redirect user to the list Apps with usage access and still select my app to check…
user9214428
0
votes
0 answers

Crash while trying to get a list of installed applications: PackageManager$NameNotFoundException

I have a crash at several users (running android 7.0/7.1) which I can't reproduce. The crash happens in a module in which I try to get the list of installed app. I tested the app on real hw and all sorts of emulators without issues. I show below a…
narb
  • 958
  • 1
  • 13
  • 39
0
votes
1 answer

How to get foreground application on Android; Excluding Notifications

I am currently using Android UsageStats to get the current foreground application in android inside a Service. However, when I get a notification from any app, my app thinks the other app is in the foreground. "Whew, that was a booger to…
Nathan Bird
  • 910
  • 1
  • 9
  • 23
0
votes
0 answers

Usage Stats Service - queryEvent not working on android 5 device (not on all though)

I use following code to get current foreground apps package name in my app. I have one user running android 5, where this always returns null (I have other users running android 5 confirming, that my code is working!). The user installs my app,…
prom85
  • 16,896
  • 17
  • 122
  • 242
0
votes
1 answer

UsageStatsManager start returning packagename from new notification and not Current Running

I was previously developed android application for app lock which is running on Idea of getting current running process's package name for both below lollipop and above lollipop versions. But Now In Marshmallow there is a problem of getting correct…
0
votes
1 answer

Get foreground app API level 21

As ActivityManager.getRunningTasks is deprecated from API level 21. So I decided to use UsageStatsManager instead. But getSystemService(USAGE_STATS_SERVICE) is only available from API level 22. That means I can only get the foreground package name…
The Dark Knight
  • 383
  • 1
  • 10
  • 21
-1
votes
1 answer

how to properly use queryUsageStats

I'm trying to write an android app, which will tell me usage of my installed apps. Currently i have only usage of current day. How to get to history of app's usage with queryUsageStats? Is there another way? Could someone provide an example of how…
Spriggan
  • 11
  • 1