Example usage for android.os PersistableBundle size

List of usage examples for android.os PersistableBundle size

Introduction

In this page you can find the example usage for android.os PersistableBundle size.

Prototype

public int size() 

Source Link

Document

Returns the number of mappings contained in this Bundle.

Usage

From source file:com.afwsamples.testdpc.SetupManagementFragment.java

private void maybeLaunchProvisioning(String intentAction, int requestCode) {
    Activity activity = getActivity();/*  w ww  .  j  a va  2s  .c o m*/

    Intent intent = new Intent(intentAction);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        intent.putExtra(EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME,
                DeviceAdminReceiver.getComponentName(getActivity()));
    } else {
        intent.putExtra(EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME, getActivity().getPackageName());
    }

    if (!maybeSpecifyNExtras(intent)) {
        // Unable to handle user-input - can't continue.
        return;
    }
    PersistableBundle adminExtras = new PersistableBundle();
    maybeSpecifySyncAuthExtras(intent, adminExtras);
    maybePassAffiliationIds(intent, adminExtras);
    specifySkipUserConsent(intent);
    specifyKeepAccountMigrated(intent);
    specifySkipEncryption(intent);
    specifyDefaultDisclaimers(intent);

    if (adminExtras.size() > 0) {
        intent.putExtra(EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE, adminExtras);
    }
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        startActivityForResult(intent, requestCode);
    } else {
        Toast.makeText(activity, R.string.provisioning_not_supported, Toast.LENGTH_SHORT).show();
    }
}