共用方式為


DevicePolicyManager.IsDeviceOwnerApp(String) Method

Definition

Used to determine if a particular package has been registered as a Device Owner app.

[Android.Runtime.Register("isDeviceOwnerApp", "(Ljava/lang/String;)Z", "GetIsDeviceOwnerApp_Ljava_lang_String_Handler")]
public virtual bool IsDeviceOwnerApp (string? packageName);
[<Android.Runtime.Register("isDeviceOwnerApp", "(Ljava/lang/String;)Z", "GetIsDeviceOwnerApp_Ljava_lang_String_Handler")>]
abstract member IsDeviceOwnerApp : string -> bool
override this.IsDeviceOwnerApp : string -> bool

Parameters

packageName
String

the package name of the app, to compare with the registered device owner app, if any.

Returns

whether or not the package is registered as the device owner app.

Attributes

Remarks

Used to determine if a particular package has been registered as a Device Owner app. A device owner app is a special device admin that cannot be deactivated by the user, once activated as a device admin. It also cannot be uninstalled. To check whether a particular package is currently registered as the device owner app, pass in the package name from Context#getPackageName() to this method.<p/>This is useful for device admin apps that want to check whether they are also registered as the device owner app. The exact mechanism by which a device admin app is registered as a device owner app is defined by the setup process.

Java documentation for android.app.admin.DevicePolicyManager.isDeviceOwnerApp(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