Freigeben über


UsageStatsManager.IsAppInactive(String) Method

Definition

Returns whether the specified app is currently considered inactive.

[Android.Runtime.Register("isAppInactive", "(Ljava/lang/String;)Z", "", ApiSince=23)]
public bool IsAppInactive (string? packageName);
[<Android.Runtime.Register("isAppInactive", "(Ljava/lang/String;)Z", "", ApiSince=23)>]
member this.IsAppInactive : string -> bool

Parameters

packageName
String

The package name of the app to query

Returns

whether the app is currently considered inactive or false if querying another app without android.Manifest.permission#PACKAGE_USAGE_STATS

Attributes

Remarks

Returns whether the specified app is currently considered inactive. This will be true if the app hasn't been used directly or indirectly for a period of time defined by the system. This could be of the order of several hours or days. Apps are not considered inactive when the device is charging.

The caller must have android.Manifest.permission#PACKAGE_USAGE_STATS to query the inactive state of other apps

Java documentation for android.app.usage.UsageStatsManager.isAppInactive(java.lang.String).

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