Example usage for android.app.admin DevicePolicyManager EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME

List of usage examples for android.app.admin DevicePolicyManager EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME

Introduction

In this page you can find the example usage for android.app.admin DevicePolicyManager EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME.

Prototype

String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME

To view the source code for android.app.admin DevicePolicyManager EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME.

Click Source Link

Document

A String extra holding the package name of the mobile device management application that will be set as the profile owner or device owner.

Usage

From source file:com.example.android.nfcprovisioning.ProvisioningValuesLoader.java

private void loadSystemValues(HashMap<String, String> values) {
    Context context = getContext();
    putIfMissing(values, DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME,
            "com.example.android.deviceowner");
    putIfMissing(values, DevicePolicyManager.EXTRA_PROVISIONING_LOCALE,
            context.getResources().getConfiguration().locale.toString());
    putIfMissing(values, DevicePolicyManager.EXTRA_PROVISIONING_TIME_ZONE, TimeZone.getDefault().getID());
    if (!values.containsKey(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_SSID)) {
        WifiManager wifiManager = (WifiManager) context.getSystemService(Activity.WIFI_SERVICE);
        WifiInfo info = wifiManager.getConnectionInfo();
        values.put(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_SSID, trimSsid(info.getSSID()));
    }//from   ww  w . jav  a2 s  .  co  m
}

From source file:com.example.android.nfcprovisioning.NfcProvisioningFragment.java

@Override
public void onTextChanged(int id, String s) {
    if (mProvisioningValues == null) {
        return;/*w w w.j  a v  a 2 s  .c  o m*/
    }
    switch (id) {
    case R.id.package_name:
        mProvisioningValues.put(DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME, s);
        break;
    case R.id.locale:
        mProvisioningValues.put(DevicePolicyManager.EXTRA_PROVISIONING_LOCALE, s);
        break;
    case R.id.timezone:
        mProvisioningValues.put(DevicePolicyManager.EXTRA_PROVISIONING_TIME_ZONE, s);
        break;
    case R.id.wifi_ssid:
        mProvisioningValues.put(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_SSID, s);
        break;
    case R.id.wifi_security_type:
        mProvisioningValues.put(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_SECURITY_TYPE, s);
        break;
    case R.id.wifi_password:
        mProvisioningValues.put(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_PASSWORD, s);
        break;
    }
}

From source file:com.example.android.nfcprovisioning.NfcProvisioningFragment.java

@Override
public void onLoadFinished(Loader<Map<String, String>> loader, Map<String, String> values) {
    if (loader.getId() == LOADER_PROVISIONING_VALUES) {
        mProvisioningValues = values;/* w w  w .j ava2 s.  c o  m*/
        mEditPackageName.setText(values.get(DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME));
        mEditLocale.setText(values.get(DevicePolicyManager.EXTRA_PROVISIONING_LOCALE));
        mEditTimezone.setText(values.get(DevicePolicyManager.EXTRA_PROVISIONING_TIME_ZONE));
        mEditWifiSsid.setText(values.get(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_SSID));
        mEditWifiSecurityType.setText(values.get(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_SECURITY_TYPE));
        mEditWifiPassword.setText(null);
    }
}