Java Code Examples for android.content.Intent#ACTION_USER_SWITCHED

The following examples show how to use android.content.Intent#ACTION_USER_SWITCHED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MediaRouterService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void systemRunning() {
    IntentFilter filter = new IntentFilter(Intent.ACTION_USER_SWITCHED);
    mContext.registerReceiver(new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals(Intent.ACTION_USER_SWITCHED)) {
                switchUser();
            }
        }
    }, filter);

    switchUser();
}