Friday, March 09, 2018

Managing Multiple Android Devices for the Lazy and Impatient

Recall that I've got a handful of Android devices that need to be configured, and not enough time and patience to do so. I progress on this challenge by writing a shell script around adb that pulls down, pushes up and deletes the apps from a phone.

While this allows me to install and uninstall apps in bulk, it doesn't account for app settings. In my case, settings are key because I need to lock down these devices to insure they remain in content creation mode only (Sorry, no YouTube or Fruit Ninja here). Previously, the ability to lock out apps was provided by Apex Launcher; a slick app, but one that was both too complex and not bullet proof enough for my needs.

I was able to solve both my configuration problem and improve the launcher experience by taking advantage of two new facilities.

First, on the master phone, I installed Kids Place - Parental Control. This is a far simpler launcher than Apex, and is a natural fit my use case. Kids Place is one of many launchers that provide a very simple user experience on the front end, while letting the parent configure the available apps on the back-end. What makes it unique is that the free version is fully functional and doesn't display ads. The pro version offers some nice to haves such as controlling the time of day the device is available and allowing you to put a custom photo in the background. But for my purposes, these features aren't needed and the free version is ideal.

Next, I took advantage of the backup ability that adb offers. This can be configured to not only grab the app files, like I had previously rigged up, but also grabs the apps settings. This command line does the trick for me:

  adb backup -shared -nosystem -all -apk -f master.ab

The nosystem flag insures that only the add-on app configurations are stored in my master snapshot. The apk flag insures that the backup contains the app itself, which makes for easy device restoration.

Once I have my master backup, I can use 'abb restore' to create a cloned.

  adb restore master.ab

The process isn't perfect. For example, it take a few screen presses to complete. But it's far simpler than having to hand-configure device after device. Once the restore is done, and the Kids Place launcher is activated, I've got a neat clone of my master device:

This looks to be the Android Enterprise Device Management strategy I was originally after. I can install and configure apps on one device, and painlessly replicate this effort to its siblings.

Bonus Pro Tip: The backup file generated above can be unpacked with this one liner:

  ( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 ../non_system.ab ) | tar -xvf -

This allows you to get a behind the scenes look at the data your phone is storing; something that is surprisingly difficult to do. (It's your phone after all, yet Android permissions work tirelessly to avoid giving you access)

No comments:

Post a Comment


Related Posts with Thumbnails