1

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);
    }
}
2Dee
  • 8,609
  • 7
  • 42
  • 53
sunil jain
  • 130
  • 2
  • 11
  • possible duplicate of [Checksum Error while provisioning Android Lollipop](http://stackoverflow.com/questions/26509770/checksum-error-while-provisioning-android-lollipop) – Michael Roland Jan 22 '15 at 19:44

1 Answers1

3

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

Akhil
  • 829
  • 1
  • 11
  • 26