UsageStatsManager.QueryEventStats(UsageStatsInterval, Int64, Int64) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets aggregated event stats for the given time range, aggregated by the specified interval.
[Android.Runtime.Register("queryEventStats", "(IJJ)Ljava/util/List;", "", ApiSince=28)]
public System.Collections.Generic.IList<Android.App.Usage.EventStats>? QueryEventStats (Android.App.Usage.UsageStatsInterval intervalType, long beginTime, long endTime);
[<Android.Runtime.Register("queryEventStats", "(IJJ)Ljava/util/List;", "", ApiSince=28)>]
member this.QueryEventStats : Android.App.Usage.UsageStatsInterval * int64 * int64 -> System.Collections.Generic.IList<Android.App.Usage.EventStats>
Parameters
- intervalType
- UsageStatsInterval
The time interval by which the stats are aggregated.
- beginTime
- Int64
The inclusive beginning of the range of stats to include in the results.
Defined in terms of "Unix time", see
java.lang.System#currentTimeMillis
.
- endTime
- Int64
The exclusive end of the range of stats to include in the results. Defined
in terms of "Unix time", see java.lang.System#currentTimeMillis
.
Returns
A list of EventStats
- Attributes
Remarks
Gets aggregated event stats for the given time range, aggregated by the specified interval.
The returned list will contain a EventStats
object for each event type that is being aggregated and has data for an interval that is a subset of the time range given.
The current event types that will be aggregated here are:
<ul> <li>UsageEvents.Event#SCREEN_INTERACTIVE
</li> <li>UsageEvents.Event#SCREEN_NON_INTERACTIVE
</li> <li>UsageEvents.Event#KEYGUARD_SHOWN
</li> <li>UsageEvents.Event#KEYGUARD_HIDDEN
</li> </ul>
The caller must have android.Manifest.permission#PACKAGE_USAGE_STATS
<em>Note: Starting from android.os.Build.VERSION_CODES#R Android R
, if the user's device is not in an unlocked state (as defined by UserManager#isUserUnlocked()
), then null
will be returned.</em>
Java documentation for android.app.usage.UsageStatsManager.queryEventStats(int, long, long)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.