sunil jain
sunil jain

Reputation: 130

Checksum Error while Creating Device Owner Android Lollipop

I am working on device onwer app in which i have to install my app as device owner using NFC but when i touch two device and trying to install app it is giving error "Couldn't install Admin app due to checksum error"

Please let me know where i am doing wrong.

Here is my code:

@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);
    }
}

Upvotes: 1

Views: 576

Answers (1)

Akhil
Akhil

Reputation: 829

Try replacing dl=0 with dl=1 in your dropbox URL :)

Upvotes: 3

Related Questions