Example usage for android.os UserManager KEY_RESTRICTIONS_PENDING

List of usage examples for android.os UserManager KEY_RESTRICTIONS_PENDING

Introduction

In this page you can find the example usage for android.os UserManager KEY_RESTRICTIONS_PENDING.

Prototype

String KEY_RESTRICTIONS_PENDING

To view the source code for android.os UserManager KEY_RESTRICTIONS_PENDING.

Click Source Link

Document

Application restriction key that is used to indicate the pending arrival of real restrictions for the app.

Usage

From source file:com.google.codelabs.appauth.MainActivity.java

private void getAppRestrictions() {
    RestrictionsManager restrictionsManager = (RestrictionsManager) this
            .getSystemService(Context.RESTRICTIONS_SERVICE);

    Bundle appRestrictions = restrictionsManager.getApplicationRestrictions();

    // Block user if KEY_RESTRICTIONS_PENDING is true, and save login hint if available
    if (!appRestrictions.isEmpty()) {
        if (appRestrictions.getBoolean(UserManager.KEY_RESTRICTIONS_PENDING) != true) {
            mLoginHint = appRestrictions.getString(LOGIN_HINT);
        } else {/*from   ww  w.  ja  va 2s  .  com*/
            Toast.makeText(this, R.string.restrictions_pending_block_user, Toast.LENGTH_LONG).show();
            finish();
        }
    }
}