Properties p = new Properties();
p.setProperty(DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME,"com.somepackage.app");
p.setProperty(DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION,"https"//example.com/app/app.apk");
p.setProperty(DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM,"akjlsdghadkq");
p.setProperty(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_SSID, "aaaSSID");
p.setProperty(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_PASSWORD,"password");
p.setProperty(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_SECURITY_TYPE, "WPA");
p.setProperty(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_HIDDEN, "false");
ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStream out;
out = new ObjectOutputStream(bos);
p.store(out, "");
final byte[] bytes = bos.toByteArray();
record = (NdefRecord.createMime("application/com.android.managedprovisioning", bytes));
I have used the above code for NFC message. Everything works fine except the Wifi part. The process stalls with "Connecting Wifi" screen when Wifi is included in the NFC message.
When the Wifi settings are not included in the NFC message, a list of available Wifi Networks is shown from which any network chosen. After that, it downloads the .apk file from the specified download url, computes checksum and verifies it with the specified checksum in the nfc message. Finally device owner is activated.
The problem occurs only when the Wifi details are specified in the NFC message. The device owner provisioning process stalls with "Connecting Wifi".
The same occurs when the wrong Wifi password is provided. There is no indication that the password is wrong.
Kindly help me with this!