다음을 통해 공유


PackageManager.IsPackageSuspended Property

Definition

Apps can query this to know if they have been suspended.

public virtual bool IsPackageSuspended { [Android.Runtime.Register("isPackageSuspended", "()Z", "GetIsPackageSuspendedHandler", ApiSince=28)] get; }
[<get: Android.Runtime.Register("isPackageSuspended", "()Z", "GetIsPackageSuspendedHandler", ApiSince=28)>]
member this.IsPackageSuspended : bool

Property Value

true if the calling package has been suspended, false otherwise.

Attributes

Remarks

Apps can query this to know if they have been suspended. A system app with the permission android.permission.SUSPEND_APPS can put any app on the device into a suspended state.

While in this state, the application's notifications will be hidden, any of its started activities will be stopped and it will not be able to show toasts or dialogs or play audio. When the user tries to launch a suspended app, the system will, instead, show a dialog to the user informing them that they cannot use this app while it is suspended.

When an app is put into this state, the broadcast action Intent#ACTION_MY_PACKAGE_SUSPENDED will be delivered to any of its broadcast receivers that included this action in their intent-filters, <em>including manifest receivers.</em> Similarly, a broadcast action Intent#ACTION_MY_PACKAGE_UNSUSPENDED is delivered when a previously suspended app is taken out of this state. Apps are expected to use these to gracefully deal with transitions to and from this state.

Java documentation for android.content.pm.PackageManager.isPackageSuspended().

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