简体   繁体   中英

Unable to connect Wifi during Device Owner activation in Android 5.0 via NFC

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!

We have also had some issues with wifi and Device Owner provisioning in L MR0 (Android 5.0).

However this issue and many more small bugs have been fixed in L MR1, so please try to use L MR1 (Android 5.1) if you can. It works for us now in L MR1.

The issues have mainly been in the ManagedProvisioning git: https://android.googlesource.com/platform/packages/apps/ManagedProvisioning/

(I work at Sony Mobile.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM