Example usage for android.content Intent ACTION_USER_UNLOCKED

List of usage examples for android.content Intent ACTION_USER_UNLOCKED

Introduction

In this page you can find the example usage for android.content Intent ACTION_USER_UNLOCKED.

Prototype

String ACTION_USER_UNLOCKED

To view the source code for android.content Intent ACTION_USER_UNLOCKED.

Click Source Link

Document

Broadcast Action: Sent when the credential-encrypted private storage has become unlocked for the target user.

Usage

From source file:com.google.android.apps.muzei.MuzeiWallpaperService.java

@Override
public void onCreate() {
    super.onCreate();
    if (UserManagerCompat.isUserUnlocked(this)) {
        initialize();/*from w  w  w.j a va 2  s.  co  m*/
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        mUnlockReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                initialize();
                unregisterReceiver(this);
            }
        };
        IntentFilter filter = new IntentFilter(Intent.ACTION_USER_UNLOCKED);
        registerReceiver(mUnlockReceiver, filter);
    }
}