QR code provisioning into Device Owner mode fails












1















I have a device running Android 7.1.1 and I am building sample DPC app in preparation for making a COSU kiosk app but I keep running into an error in the provisioning setup.



Steps I take:




  1. Factory reset the device

  2. Successfully scan the code from the QR provisioning screen

  3. App downloads successfully and checksum check passes. I know this because at first it kept failing at wrongly generated checksum.

  4. Installing app message passes without error.

  5. The message changes to "Setting the device owner..." and immediately fails with the generic message "Oops! Couldn't set up your device..."


I've put simple Toast in DeviceAdminReceiver subclass into onEnabled and onProvisioningComplete functions. The Toast in onEnabled is displayed, the one in onProvisioningComplete is unsuprisingly not.



The app is signed with proper release certificate, setting the device owner through adb works fine as well which also leads me to belief that component name and manifest is ok otherwise adb command would fail as well.



QR code text:



{
"android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "component name",
"android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "the checksum",
"android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "the link",
"android.app.extra.PROVISIONING_SKIP_ENCRYPTION" : "True",
"android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED" : "True"
}


Any ideas what might be wrong ? I've run out of mine. Thanks for any input !










share|improve this question



























    1















    I have a device running Android 7.1.1 and I am building sample DPC app in preparation for making a COSU kiosk app but I keep running into an error in the provisioning setup.



    Steps I take:




    1. Factory reset the device

    2. Successfully scan the code from the QR provisioning screen

    3. App downloads successfully and checksum check passes. I know this because at first it kept failing at wrongly generated checksum.

    4. Installing app message passes without error.

    5. The message changes to "Setting the device owner..." and immediately fails with the generic message "Oops! Couldn't set up your device..."


    I've put simple Toast in DeviceAdminReceiver subclass into onEnabled and onProvisioningComplete functions. The Toast in onEnabled is displayed, the one in onProvisioningComplete is unsuprisingly not.



    The app is signed with proper release certificate, setting the device owner through adb works fine as well which also leads me to belief that component name and manifest is ok otherwise adb command would fail as well.



    QR code text:



    {
    "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "component name",
    "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "the checksum",
    "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "the link",
    "android.app.extra.PROVISIONING_SKIP_ENCRYPTION" : "True",
    "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED" : "True"
    }


    Any ideas what might be wrong ? I've run out of mine. Thanks for any input !










    share|improve this question

























      1












      1








      1








      I have a device running Android 7.1.1 and I am building sample DPC app in preparation for making a COSU kiosk app but I keep running into an error in the provisioning setup.



      Steps I take:




      1. Factory reset the device

      2. Successfully scan the code from the QR provisioning screen

      3. App downloads successfully and checksum check passes. I know this because at first it kept failing at wrongly generated checksum.

      4. Installing app message passes without error.

      5. The message changes to "Setting the device owner..." and immediately fails with the generic message "Oops! Couldn't set up your device..."


      I've put simple Toast in DeviceAdminReceiver subclass into onEnabled and onProvisioningComplete functions. The Toast in onEnabled is displayed, the one in onProvisioningComplete is unsuprisingly not.



      The app is signed with proper release certificate, setting the device owner through adb works fine as well which also leads me to belief that component name and manifest is ok otherwise adb command would fail as well.



      QR code text:



      {
      "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "component name",
      "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "the checksum",
      "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "the link",
      "android.app.extra.PROVISIONING_SKIP_ENCRYPTION" : "True",
      "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED" : "True"
      }


      Any ideas what might be wrong ? I've run out of mine. Thanks for any input !










      share|improve this question














      I have a device running Android 7.1.1 and I am building sample DPC app in preparation for making a COSU kiosk app but I keep running into an error in the provisioning setup.



      Steps I take:




      1. Factory reset the device

      2. Successfully scan the code from the QR provisioning screen

      3. App downloads successfully and checksum check passes. I know this because at first it kept failing at wrongly generated checksum.

      4. Installing app message passes without error.

      5. The message changes to "Setting the device owner..." and immediately fails with the generic message "Oops! Couldn't set up your device..."


      I've put simple Toast in DeviceAdminReceiver subclass into onEnabled and onProvisioningComplete functions. The Toast in onEnabled is displayed, the one in onProvisioningComplete is unsuprisingly not.



      The app is signed with proper release certificate, setting the device owner through adb works fine as well which also leads me to belief that component name and manifest is ok otherwise adb command would fail as well.



      QR code text:



      {
      "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "component name",
      "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "the checksum",
      "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "the link",
      "android.app.extra.PROVISIONING_SKIP_ENCRYPTION" : "True",
      "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED" : "True"
      }


      Any ideas what might be wrong ? I've run out of mine. Thanks for any input !







      android qr-code provisioning device-owner






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 '18 at 14:22









      HeavylamaHeavylama

      133




      133
























          1 Answer
          1






          active

          oldest

          votes


















          1














          {
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.my.app/com.my.app.MyDeviceAdminReceiver",
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "the checksum",
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "the link",
          "android.app.extra.PROVISIONING_SKIP_ENCRYPTION" : true,
          "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED" : true
          }


          values for PROVISIONING_SKIP_ENCRYPTION and PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED should be boolean, not strings. At least its boolean in my app and it works.



          Also make sure you specified the component name of the device admin receiver in a proper way. the specified component must extend android.app.admin.DeviceAdminReceiver.






          share|improve this answer


























          • The bools did the trick. Thank you! At first I was testing without SKIP_ENCRYPTION and LEAVE_ALL_SYSTEM_APPS_ENABLED fields and it wasn't working anyway, curious.

            – Heavylama
            Nov 23 '18 at 9:14








          • 1





            I think you've missed a double-quote in front of com.my.app.... on the first line.

            – TripeHound
            Nov 23 '18 at 9:19













          • @TripeHound you are right, fixed it.

            – Philip Zultan
            Nov 23 '18 at 11:23











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53395081%2fqr-code-provisioning-into-device-owner-mode-fails%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          {
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.my.app/com.my.app.MyDeviceAdminReceiver",
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "the checksum",
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "the link",
          "android.app.extra.PROVISIONING_SKIP_ENCRYPTION" : true,
          "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED" : true
          }


          values for PROVISIONING_SKIP_ENCRYPTION and PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED should be boolean, not strings. At least its boolean in my app and it works.



          Also make sure you specified the component name of the device admin receiver in a proper way. the specified component must extend android.app.admin.DeviceAdminReceiver.






          share|improve this answer


























          • The bools did the trick. Thank you! At first I was testing without SKIP_ENCRYPTION and LEAVE_ALL_SYSTEM_APPS_ENABLED fields and it wasn't working anyway, curious.

            – Heavylama
            Nov 23 '18 at 9:14








          • 1





            I think you've missed a double-quote in front of com.my.app.... on the first line.

            – TripeHound
            Nov 23 '18 at 9:19













          • @TripeHound you are right, fixed it.

            – Philip Zultan
            Nov 23 '18 at 11:23
















          1














          {
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.my.app/com.my.app.MyDeviceAdminReceiver",
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "the checksum",
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "the link",
          "android.app.extra.PROVISIONING_SKIP_ENCRYPTION" : true,
          "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED" : true
          }


          values for PROVISIONING_SKIP_ENCRYPTION and PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED should be boolean, not strings. At least its boolean in my app and it works.



          Also make sure you specified the component name of the device admin receiver in a proper way. the specified component must extend android.app.admin.DeviceAdminReceiver.






          share|improve this answer


























          • The bools did the trick. Thank you! At first I was testing without SKIP_ENCRYPTION and LEAVE_ALL_SYSTEM_APPS_ENABLED fields and it wasn't working anyway, curious.

            – Heavylama
            Nov 23 '18 at 9:14








          • 1





            I think you've missed a double-quote in front of com.my.app.... on the first line.

            – TripeHound
            Nov 23 '18 at 9:19













          • @TripeHound you are right, fixed it.

            – Philip Zultan
            Nov 23 '18 at 11:23














          1












          1








          1







          {
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.my.app/com.my.app.MyDeviceAdminReceiver",
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "the checksum",
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "the link",
          "android.app.extra.PROVISIONING_SKIP_ENCRYPTION" : true,
          "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED" : true
          }


          values for PROVISIONING_SKIP_ENCRYPTION and PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED should be boolean, not strings. At least its boolean in my app and it works.



          Also make sure you specified the component name of the device admin receiver in a proper way. the specified component must extend android.app.admin.DeviceAdminReceiver.






          share|improve this answer















          {
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.my.app/com.my.app.MyDeviceAdminReceiver",
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "the checksum",
          "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "the link",
          "android.app.extra.PROVISIONING_SKIP_ENCRYPTION" : true,
          "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED" : true
          }


          values for PROVISIONING_SKIP_ENCRYPTION and PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED should be boolean, not strings. At least its boolean in my app and it works.



          Also make sure you specified the component name of the device admin receiver in a proper way. the specified component must extend android.app.admin.DeviceAdminReceiver.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 23 '18 at 11:23

























          answered Nov 23 '18 at 6:59









          Philip ZultanPhilip Zultan

          345




          345













          • The bools did the trick. Thank you! At first I was testing without SKIP_ENCRYPTION and LEAVE_ALL_SYSTEM_APPS_ENABLED fields and it wasn't working anyway, curious.

            – Heavylama
            Nov 23 '18 at 9:14








          • 1





            I think you've missed a double-quote in front of com.my.app.... on the first line.

            – TripeHound
            Nov 23 '18 at 9:19













          • @TripeHound you are right, fixed it.

            – Philip Zultan
            Nov 23 '18 at 11:23



















          • The bools did the trick. Thank you! At first I was testing without SKIP_ENCRYPTION and LEAVE_ALL_SYSTEM_APPS_ENABLED fields and it wasn't working anyway, curious.

            – Heavylama
            Nov 23 '18 at 9:14








          • 1





            I think you've missed a double-quote in front of com.my.app.... on the first line.

            – TripeHound
            Nov 23 '18 at 9:19













          • @TripeHound you are right, fixed it.

            – Philip Zultan
            Nov 23 '18 at 11:23

















          The bools did the trick. Thank you! At first I was testing without SKIP_ENCRYPTION and LEAVE_ALL_SYSTEM_APPS_ENABLED fields and it wasn't working anyway, curious.

          – Heavylama
          Nov 23 '18 at 9:14







          The bools did the trick. Thank you! At first I was testing without SKIP_ENCRYPTION and LEAVE_ALL_SYSTEM_APPS_ENABLED fields and it wasn't working anyway, curious.

          – Heavylama
          Nov 23 '18 at 9:14






          1




          1





          I think you've missed a double-quote in front of com.my.app.... on the first line.

          – TripeHound
          Nov 23 '18 at 9:19







          I think you've missed a double-quote in front of com.my.app.... on the first line.

          – TripeHound
          Nov 23 '18 at 9:19















          @TripeHound you are right, fixed it.

          – Philip Zultan
          Nov 23 '18 at 11:23





          @TripeHound you are right, fixed it.

          – Philip Zultan
          Nov 23 '18 at 11:23




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53395081%2fqr-code-provisioning-into-device-owner-mode-fails%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents