Share via


DevicePolicyManager.LogoutUser(ComponentName) Method

Definition

Called by a profile owner of secondary user that is affiliated with the device to stop the calling user and switch back to primary user (when the user was #switchUser(ComponentName, UserHandle) switched to) or stop the user (when it was #startUserInBackground(ComponentName, UserHandle) started in background.

[Android.Runtime.Register("logoutUser", "(Landroid/content/ComponentName;)I", "GetLogoutUser_Landroid_content_ComponentName_Handler", ApiSince=28)]
public virtual Android.OS.UserOperationResultCode LogoutUser (Android.Content.ComponentName admin);
[<Android.Runtime.Register("logoutUser", "(Landroid/content/ComponentName;)I", "GetLogoutUser_Landroid_content_ComponentName_Handler", ApiSince=28)>]
abstract member LogoutUser : Android.Content.ComponentName -> Android.OS.UserOperationResultCode
override this.LogoutUser : Android.Content.ComponentName -> Android.OS.UserOperationResultCode

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with.

Returns

one of the following result codes: UserManager#USER_OPERATION_ERROR_UNKNOWN, UserManager#USER_OPERATION_SUCCESS, UserManager#USER_OPERATION_ERROR_MANAGED_PROFILE, UserManager#USER_OPERATION_ERROR_CURRENT_USER

Attributes

Remarks

Called by a profile owner of secondary user that is affiliated with the device to stop the calling user and switch back to primary user (when the user was #switchUser(ComponentName, UserHandle) switched to) or stop the user (when it was #startUserInBackground(ComponentName, UserHandle) started in background.

Notice that on devices running with UserManager#isHeadlessSystemUserMode() headless system user mode, there is no primary user, so it switches back to the user that was in the foreground before the first call to #switchUser(ComponentName, UserHandle) (or fails with UserManager#USER_OPERATION_ERROR_UNKNOWN if that method was not called prior to this call).

Java documentation for android.app.admin.DevicePolicyManager.logoutUser(android.content.ComponentName).

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