Tuesday, January 22, 2013

Gotcha of the Day: Setting up an Adobe AIR App to run as a Launcher on Android

One of my customer's wants to turn a collection of Android tablets into devices that just run their Adobe AIR Android App. Effectively, they want them to run in a kiosk mode.

My thought was that I'd have to either leverage an existing app launcher, or code my own, to support this. Turns out, it's much easier than this. I found the answer clearly spelled out here:

Making an application that can be installed as a Home Screen is simple; you just have to add the HOME intent category to the main Activity's intent filter.

Hard to believe, but all one needs to do is to hack the AndroidManifest.xml and you're all set.

This is slightly tricky in the Adobe AIR world because: (a) you don't have direct access to the AndroidManifest.xml and (b) you don't directly create or name the specific activity that gets run in the app. It took fiddling, but I solved both these issues by putting the following in my Air App's application descriptor:

Setting android:name=".AppEntry" is especially key, otherwise the device won't be able to start your application up properly.

Once you've updated your deployment descriptor and rebuilt and installed the apk file, you must do the following:

Click on the home button on your device

You should get a system dialog asking you which application should complete the action

Choose your application and click 'Always'

Reboot your device

Confirm, when it starts up, that the only application available is yours

If all went well, you'll have turned your general purpose tablet or phone into a one-app-wonder.

To get things back to normal, remove your app using a tool like adb.exe or MobileGo from Wondershare. I don't know much about the later option, other than it's quite a bit more user friendly than adb.exe, so it may be more appropriate to an audience who just wants to experiment with the kiosk app you've built.