Freigeben über


UsageStatsManager.QueryEvents Method

Definition

Overloads

QueryEvents(UsageEventsQuery)

Query for events with specific UsageEventsQuery object.

QueryEvents(Int64, Int64)

Query for events in the given time range.

QueryEvents(UsageEventsQuery)

Query for events with specific UsageEventsQuery object.

[Android.Runtime.Register("queryEvents", "(Landroid/app/usage/UsageEventsQuery;)Landroid/app/usage/UsageEvents;", "", ApiSince=35)]
[Android.Runtime.RequiresPermission("android.permission.PACKAGE_USAGE_STATS")]
public Android.App.Usage.UsageEvents? QueryEvents (Android.App.Usage.UsageEventsQuery query);
[<Android.Runtime.Register("queryEvents", "(Landroid/app/usage/UsageEventsQuery;)Landroid/app/usage/UsageEvents;", "", ApiSince=35)>]
[<Android.Runtime.RequiresPermission("android.permission.PACKAGE_USAGE_STATS")>]
member this.QueryEvents : Android.App.Usage.UsageEventsQuery -> Android.App.Usage.UsageEvents

Parameters

query
UsageEventsQuery

The query object used to specify the query parameters.

Returns

A UsageEvents which contains the events matching the query parameters.

Attributes

Remarks

Query for events with specific UsageEventsQuery object.

<em>Note: 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.queryEvents(android.app.usage.UsageEventsQuery).

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.

Applies to

QueryEvents(Int64, Int64)

Query for events in the given time range.

[Android.Runtime.Register("queryEvents", "(JJ)Landroid/app/usage/UsageEvents;", "")]
public Android.App.Usage.UsageEvents? QueryEvents (long beginTime, long endTime);
[<Android.Runtime.Register("queryEvents", "(JJ)Landroid/app/usage/UsageEvents;", "")>]
member this.QueryEvents : int64 * int64 -> Android.App.Usage.UsageEvents

Parameters

beginTime
Int64

The inclusive beginning of the range of events 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 events to include in the results. Defined in terms of "Unix time", see java.lang.System#currentTimeMillis.

Returns

A UsageEvents.

Attributes

Remarks

Query for events in the given time range. Events are only kept by the system for a few days.

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.queryEvents(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.

Applies to