Share via


CrossProfileApps.CanInteractAcrossProfiles Method

Definition

Returns whether the calling package can interact across profiles.

[Android.Runtime.Register("canInteractAcrossProfiles", "()Z", "GetCanInteractAcrossProfilesHandler", ApiSince=30)]
public virtual bool CanInteractAcrossProfiles ();
[<Android.Runtime.Register("canInteractAcrossProfiles", "()Z", "GetCanInteractAcrossProfilesHandler", ApiSince=30)>]
abstract member CanInteractAcrossProfiles : unit -> bool
override this.CanInteractAcrossProfiles : unit -> bool

Returns

true if the calling package can interact across profiles.

Attributes

Remarks

Returns whether the calling package can interact across profiles.

Specifically, returns whether the following are all true: <ul> <li>#getTargetUserProfiles() returns a non-empty list for the calling user.</li> <li>The user has previously consented to cross-profile communication for the calling package.</li> <li>The calling package has either been allowlisted by default by the OEM or has been explicitly allowlisted by the admin via android.app.admin.DevicePolicyManager#setCrossProfilePackages(ComponentName, Set). </li> </ul>

If false, the package's current ability to request user consent to interact across profiles can be checked with #canRequestInteractAcrossProfiles(). If true, user consent can be obtained via #createRequestInteractAcrossProfilesIntent(). The package can then listen to #ACTION_CAN_INTERACT_ACROSS_PROFILES_CHANGED broadcasts.

Java documentation for android.content.pm.CrossProfileApps.canInteractAcrossProfiles().

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