Thursday, March 01, 2018

Android Enterprise Device Management for the tiny, broke and geeky enterprise

I'm tackling the next challenge in my makePad experiment: working with multiple devices. The devices were easy enough to come by. I simply ordered 3 more BLU Advance 4.0 phones from Amazon. What I'm not looking forward to is configuring three new devices by hand.

And let's say I do manage to put up with the hassle of manually installing and customizing each phone. What happens when I want to make a change and experiment with a new configuration? I've now got to repeat the process again. No thank you.

A little research told me that what I wanted was an Enterprise Device Management Solution. That way, I could manage the phones in a bulk fashion. But even the name sounds complex and expensive. And researching a few platforms bore this out. I needed something simpler, but yet still effective at working with multiple devices.

As I poked around the web, I rediscovered something: the Android developer tool adb has capability to install and uninstall apps from the command line. Not only that, but you can query the packages installed on a phone and even download the APKs for apps installed on the phone. All without root access.

This was encouraging: what I lacked in enterprise funding and staff I could make up for in dev skills. Using this knowledge about adb, I went ahead and built andappsnap, a tool for pushing and pulling snapshots of apps to and from Android devices. Here's how it works.

Step 1. Plug in the master phone, that is, the one with the apps you want to deploy to the rest of the devices.

Step 2. Run andappsnap:

 andappsnap -c pull -d makepad-20180301

This command will pull all the 3rd party apps off of the master device and store them in a directory named makepad-20180301. In this directory is a file named apps.index which lists all of the apps that were captured.

Step 3. Unplug the master phone and plug in device to be configured.

Step 4. Run andappsnap:

 andappsnap -c push -d makepad-20180301

Every app listed in apps.index will be installed on the device.

Step 5. Repeat steps 3 and 4 until all the devices have all the apps installed on them.

I also implemented andappsnap -c nuke which removes all third party apps on a phone. Yes, this command is dangerous. It will gladly remove every app on your 'master' phone without hesitation. But heck, the whole process is dangerous. So yeah, be careful.

andappsnap is little more than a basic shell wrapper around adb and the Android command pm. pm is an especially frustrating command to use because it lists a number of interesting operations it claims to do. Though without having root access, these operations fail. So I was truly surprised that my push and pull process worked so smoothly. The fact that I can keep around a snapshot of makepad apps and easily deploy different configurations is a surprising bonus.

Automatically installing apps on the device is a great first step in configuring my makepads in bulk. However, it's just that, a first step. There are other device setup tasks I'd like to tackle, such as configuring the launcher and disabling apps like YouTube and Chrome. Though for now, I plan to celebrate my victory over the manual app installation process and tackle those concerns later.

No comments:

Post a Comment