How to Enroll AOSP Devices on Esper

Nikhil Punathil

April 20, 2021

At Esper, AOSP devices are some of our favorite devices to work with. We’ve previously talked about choosing between GMS and non-GMS devices for your dedicated Android device. When we say AOSP, we mean devices that do not come with Google Mobile Services (GMS) and run open source Android. If you have decided to choose the AOSP route for your project, you will be glad to know that Esper is one of the few solutions in the market that is fully functional on AOSP devices.

Why is AOSP a big deal?

Traditional device management platforms utilize the APIs provided by Google in their Google Mobile Services (GMS) suite of apps to enroll devices onto their platform. While this is convenient, it cannot be used to enroll AOSP devices, since they do not include Google apps within their operating system. This eliminates three of Esper’s most popular methods of enrollment: 6-Tap QR Code, Android for Work (AfW) and Google Zero Touch Enrollment (ZTE). However, it is possible to load the Esper agent onto your device and give it the permissions it needs to begin managing your device.

Cool! How can I manage my AOSP devices with Esper?

AOSP, put in simple terms, is barebones Android. The first thing we need to do is get the Esper agent on the device. Easier said than done, since some AOSP devices don’t even include a browser app by default.
The way we do this is using a tool/interface called Android Debug Bridge (adb). Adb allows you to perform a variety of tasks on your Android device, including installing apps and accessing Android’s built-in shell. Let’s first take a look at the brute force way of doing this (better options are coming, so keep reading!)
You’ll need a few things to do this:

  1. The Esper Agent and Helper APKs
  2. A local downloaded copy of your template (you can get this by heading to your template, clicking the ellipsis (…) and selecting “Download Config” 
  3. An ADB installation. You can get the required files directly from Google here

Once you have these files in the same directory, run the following commands in order to provision the device. This assumes your Agent APK is named agent.apk and the Helper APK is named helper.apk.

adb shell mkdir -p /sdcard/Android/data/io.shoonya.shoonyadpc/files/
adb push config.json /sdcard/Android/data/io.shoonya.shoonyadpc/files/config.json
adb shell settings put global install_non_market_apps 1
adb shell settings put global package_verifier_enable 0
adb install -r -t helper.apk
adb install -r -t dpc.apk
adb shell dpm set-device-owner io.shoonya.shoonyadpc/com.shoonyaos.shoonyadpc.receivers.AdminReceiver
adb shell monkey -p io.shoonya.shoonyadpc -c android.intent.category.LAUNCHER 1

Your device should now show the Esper launcher, and you will be able to finish the provisioning process on the device, by granting a few final permissions.

This looks like too much work! Is there an easier way?

Fortunately for you, yes there is! We have developed the Esper Device Provisioner tool for our customers to onboard their dedicated AOSP devices as effortlessly as possible. Advantages of using the device provisioner include (but are not limited to): 

  1. No more setting up ADB and related drivers, downloading the provisioning template or running weird commands. Just follow the user friendly UI and you’re set within a matter of a couple minutes. 
  2. App downloads included in your template are cached so you are not wasting bandwidth downloading the same APK over and over again when provisioning multiple devices. 
  3. Ability to provision up to 16 devices simultaneously, as long as you have enough USB ports!
  4. Ability to provision over Wi-Fi if you don’t like wires, or ethernet if you do.

Sounds too good to be true – Pics or it didn’t happen

Here’s what a typical workflow would look like with the Esper Device Provisioner.

  1. Login to your Esper endpoint from within the application.
  1. Follow the instructions on the first page to enable adb on your device. When adb is enabled, click next to continue. 
  1. Select your template of choice. You can also use the search bar to quickly narrow down your option. Click next to continue. 
  1. Verify apps that are to be installed in this next page. The other options can be left alone, unless you know what you’re doing. 
  1. Select the devices you want to provision from the next screen. You can also select wireless devices by entering their local IP addresses in the appropriate field. The port number is usually 5555. 
  1. The tool should now begin provisioning your device automatically. Once it is done, you will be greeted by the Esper agent running on your device, with the last few permissions that need to be given so that the agent can fully manage your device. That’s it, it’s that simple!

Awesome! Where can I get the Esper Device Provisioner?

Download the Esper Device Provisioner for Windows, macOS and Linux from our documentation. The page also lists more in-depth instructions on how to use the tool and some common yet out of the ordinary scenarios you may encounter while using the tool.

Oh yeah? But do you support my <insert obscure Linux distro>?

Yes! We also provide an AppImage version of the tool, which you can run without any dependencies. All you need to do is mark the file as executable (chmod +x) and run it! You can find it at the same location listed above.

But what if I have hundreds or thousands of devices? Do I have to do them 16 at a time?

That doesn’t sound fun does it? Don’t worry, we’ve got you covered. We also have the ability to integrate our agent and associated files within your AOSP build. This way the device will automatically provision on flash and boot, without any additional enrollment steps, through what we call “Seamless Provisioning”. All we need for this is access to the AOSP source tree for your particular device. Sounds too good to be true, right? We will have another blog post detailing this method of provisioning soon, so stay tuned!

Conclusion

The Esper Device Provisioner is a simple and easy to use tool that can help you deploy your dedicated AOSP devices while abstracting away all the technical Android jargon. The process is beaten in simplicity only by Seamless Provisioning. We love working with dedicated AOSP devices, so if you run into any issues while working with the Device Provisioner, feel free to contact us at support@esper.io where we would be happy to look into your particular device and use-case.