创建设备所有者时校验和错误 Android Lollipop

Checksum Error while Creating Device Owner Android Lollipop

我正在开发设备 onwer 应用程序,其中我必须使用 NFC 作为设备所有者安装我的应用程序,但是当我触摸两个设备并尝试安装应用程序时出现错误 "Couldn't install Admin app due to checksum error"

请告诉我哪里做错了。

这是我的代码:

@Override
public NdefMessage createNdefMessage(NfcEvent event) {
    try {
        Properties p = new Properties();

        p.setProperty(
                DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME,
                "com.marakana.android.devicepolicydemo");
        p.setProperty(
                DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION,
                "https://www.dropbox.com/s/0mpolgzm0nufnd6/abc.apk?dl=0");
        p.setProperty(
                DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM,
         //       "3E:3F:9A:A9:29:85:52:61:5E:71:04:2F:CC:D0:B0:CC:A0:29:82:4C");
        "4tEyGrxvIf9XBgGHxneg62a6hAQ");

        p.setProperty(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_SSID, "aaa");
        p.setProperty(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_PASSWORD, "xxxxx");


        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        OutputStream out = new ObjectOutputStream(bos);
        p.store(out, "");
        final byte[] bytes = bos.toByteArray();

        NdefMessage msg = new NdefMessage(NdefRecord.createMime(
                DevicePolicyManager.MIME_TYPE_PROVISIONING_NFC, bytes));
        return msg;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

尝试将您的保管箱中的 dl=0 替换为 dl=1 URL :)