2

We are developing a COSU app using Android Management API and QR code provisioning. We're planning to distribute app with private Google play, but for now I'm trying to make it work with manual installation using apk. That's how it should work:

  1. A client receives qr code from us, that applies policy without restrictions to the device.
  2. After provisioning client downloads apk from some other source (probably via email) and installs it.
  3. Client applies policy with restrictions from app with call to API.

So, I'm stuck on second step - an attempt to install downloaded apk leads to this error:

Default policy seems to be ok:

  {
   "name": "enterprises/<enterpriseName>/policies/policy_unlocked",
   "version": "11",
   "applications": [
    {
     "packageName": "com.axmor.fsinphone",
     "installType": "AVAILABLE",
     "defaultPermissionPolicy": "GRANT"
    }
   ],
   "persistentPreferredActivities": [
    {
     "receiverActivity": "com.axmor.fsinphone",
     "actions": [
      "android.intent.action.MAIN"
     ]
    }
   ],
   "systemUpdate": {
    "type": "WINDOWED",
    "startMinutes": 120,
    "endMinutes": 240
   },
   "debuggingFeaturesAllowed": true
  }
 ]
}

And this policy is applied to device:

   "policyName": "enterprises/<enterpriseName>/policies/policy_unlocked",
   "appliedPolicyName": "enterprises/<enterpriseName>/policies/policy_unlocked",

What I've tried:

  1. Installing release apk and signed apk (same result)
  2. Installing apk with adb from Android studio - this works, but it's not what I want.
anro
  • 1,300
  • 16
  • 30
  • Have you tried installing the APK from Play? The screenshot you showed doesn't look like a message from Play, how did you do to trigger it? – Fred Apr 03 '19 at 09:43
  • No, I just build apk in Android Studio, put it in "Downloads" folder on device and try to install it from there. We are not sure yet, that our client will approve using Google play for distribution and anyway we have to somehow show the app to client while developing. – anro Apr 03 '19 at 09:59
  • 1
    I see, makes sense. In that case can you try setting `installUnknownSourcesAllowed` to `true` in the policy, see if that fixes the issue? – Fred Apr 03 '19 at 18:22
  • 1
    Thank you, that worked! But it's important to mention, that for some reason I had to reset and provision device once again. – anro Apr 04 '19 at 02:46
  • Glad it worked. And it's indeed weird that you had to reset since normally the policy should have been applied after you updated it. – Fred Apr 04 '19 at 11:01

1 Answers1

1

(copying the solution here from comments)

To be able to install apps from outside the Play Store you need to set installUnknownSourcesAllowed to true in the Policy. More details in the policy references.

Fred
  • 2,191
  • 1
  • 12
  • 14