Android 4.4 for Game Developers

Android 4.4, code name KitKat, was released today, along with the new flagship phone Nexus 5 by LG. You can find more consumer oriented info on the Official Google Blog.

Developers should check out the Android KitKat release notes, as well as this Android 4.4 playlist on the Android Developer Youtube channel.

As has become usual around these parts, we are going to look at Android 4.4 from a game dev perspective.

New Memory Analysis Tools

The Android engineers have put a lot of work into memory management in Android 4.4, so that even devices with 512MB of RAM don’t struggle. Us developers have fancy new tools to analyze and battle memory issues that crop up in our apps. procstats and meminfo allow you to gauge memory usage over time via ADB. For on-device memory stats, there’s a new developer option in Settings > Developer Options > Process stats which visualizes the procstats results in a more high-level manner. Fancy!

Screen Recording

You can now do a high-quality screen recording of your app directly via DDMS. The video gets pulled down from your device and is encoded in MP4 format. Audio is sadly not recorded, but for marketing videos you usually add your own audio anyways. I haven’t tested this myself yet, so ymmv.

Immersive Mode

Since Android 4.0 (i think), you could disable the on-screen navigation bar to let your app use all of the screen. An example of this can be found when playing Youtube videos in fullscreen mode. For games, this wasn’t a viable solution, as the navigation bar would be shown again as soon as a user touches the screen.

The new immersive mode solves this issue, and is hence fit for games! In addition to the usual fullscreen flags (which libgdx sets for your automatically), you only specify one more flag called immersive sticky, and your game will use the entire screen. To get the navigation bar, a user simply swipes down from the top of the screen. With the immersive sticky flag, the status and navigation bars will be shown for a brief moment, before they get hidden by the OS again. They are actually overlayed in a translucent manner, your OpenGL surface doesn’t get resized (this is not true for the non-stick immersive mode). I let Roman Nurik explain it in more detail:

RenderScript via the NDK

From 4.4 onwards you can use RenderScript from within your C/C++ code directly. While this may not be directly game dev related, you may still want to look into it for some special use cases, i.e. image processing. It seems like the docs for this aren’t available yet (or the are hidden in a new NDK release, which i haven’t downloaded yet).

And that’s it. Android 4.4 seems to be a really solid release, adding a nice set of new features, even printing (by creating PDFs on the fly!).

Off to buy me a new Nexus 5!

6 thoughts on “Android 4.4 for Game Developers

  1. Wow, finally, we’ve been requesting the immersive mode on Android tracker for years (since Honeycomb) and been ignored. We even described the swipe method there. 🙂

  2. Hey man… Don’t slack off on me… This wasn’t as deep as your previous posts on new OS releases… If I printed this out it’d fit on one page instead of 5! ;P J/K… keep it up… yeah… OpenCL all the way… or shall I say lets have a spectrum of computation on Android; OpenCL and Renderscript; err, OpenCL for those in the know… Though nice to see that at least the NDK folks aren’t out on the cold; I guess if API 19 is OK as a min target level. ;P I’ve been having a lot of fun with the 4.3 MediaCodec / MediaMuxer APIs, but man… buggy as shit balls and clearly not tested (IE definitely the audio aspects of encoders). Got a nice 4.3 GL pipeline abstraction that lets one easily record anything output including audio (err, still working on that for all devices; re MediaCodec POS; err, let’s be polite, “simply untested”) I expect that trend to continue into 4.4 though we’ll see what happens.. Damn it.. I didn’t jump on a N5 on initial launch, but yeah… it’ll make it here… Loving my ODROID-XU and OpenCL though still wrastling up a working Java binding; so close… ;P Oi…. Anything new with the latest RoboVM version and libgdx? Always interesting to hear about that side of things…

  3. Hah, long time no see! Frankly, there doesn’t seem to be many new features relevant for game dev, so that’s why i kept it short. There’s a new audio API it seems which allows you to monitor all current audio streams bein played back, but that’s my only omission.

    Still working away on Typhon i see 🙂 When’s the release? I’d love to play around with OpenCL, but lack a capable device.

    RoboVM is fantastic, you should use it!

  4. I know I’ve been under the gun.. Things have turned around for the better now; I did go silent for a while.. Currently on a new big contract that is using TyphonRT to pull off a next gen video capture / editing platform on Android. Big chance to prove what all the huffing / puffing may have been / is about.. ;P Hopefully it will also be that last push to get the bootstraps pulled up and walking toward public release or at least pay the rent until the thing gets out the door. Hmm.. Could always leave SF.. ;P doh…

    I definitely love to read about libgdx / RoboVM efforts; thanks for trailblazing in this direction (+ thanks Niklas!) as I’m definitely interested though I’m curious if the Java tricks (mostly generics in combo w/ generic methods) I exploit with TyphonRT will make it through in translation; gotta try it and indeed RoboVM is on the list… a long list it still is… I know release release release… ::jealous:: There is a big trial by fire presently and I’m going through it right now and indeed the public release will be the better for it. I can’t really imagine a more complex scenario to try and get working smoothly across the Android ecosystem really.

    Yeah.. OpenCL devices.. ODROID-XU was the first openly OpenCL accessible device and it’s the best developers board I’ve used yet for Android.. Got accepted to Imagination Tech / OpenCL SDK / EAP program recently; curious what that will result. Nice to finally be a little guy and get a stab at some proper resources. Sony posted a nice blog post yesterday about OpenCL on Z1 / flagship devices. IE it seems they are not taking the Google route of disabling it except for of course Renderscripts usage of OpenCL for GPU compute and goodness I hope other OEMs don’t either. You know it has great value for libgdx of course! 😀 There is the desktop which essentially translates over to mobile; for now follow the embedded profile guidelines and query the device for proper settings or let the driver decide.. I’m definitely trying to make the jump into intermediate / advanced OpenCL and modifying existing parallel radix sort implementations to find a portable solution between desktop / mobile and suss out when it’s more efficient to do things on the CPU. It seems parallel scan algorithms is the doorway to the more exciting aspects of OpenCL; IE not possible w/ Renderscript. There seemingly is a lot not possible with RS since it’s “hands free” middleware essentially. I’m going to try and wrap my head around Jogamp / JOCL and poke around a bit more; I’d like there to be a publicly available Java binding for OpenCL / Android. Sven did some initial refactoring recently, but yeah it’s just a big context switch for me with the new day gig which has some priority projects presently; yeah and sigh…. I’m getting out and talking about OpenCL at some Android conferences though including AnDevCon in a couple of weeks and OnAndroidConf recently. It’s still very much as “wild west” as it was back in the day; err, except more bugs / regressions / fragmentation… ;P So curious about what if any 4.4 fall outs we’ll see for game dev or otherwise… Audio is borked without deliberate / non-obvious workarounds via MediaCodec for 4.3 I expect it to be so for 4.4 too as I posted the first audio specific issues in the issue tracker last week or so; hey, at least they got assigned to someone.. ;P but yeah not directly game dev per se..

Leave a Reply

Your email address will not be published.