Wednesday, 14 August 2013

Tips every Android developer should know

Tips every Android developer should know, or things we're doing wrong and need to fix in our Android builds.

A couple Google engineers, Dan Galpin and Ian Lewis, gave a talk at GDC this morning on things people do that prevent their apps from getting featured. Here are my notes on what they said.

1) Don't run in compatibility mode. Google hates the menu button on newer Android devices, so set the target SDK version to the newest (15).
2) Games that use the lights out menu option are cool. This is View.Status_Bar_Hidden.
3) Don't override the basic button behavior like volume or home or power. The back button is fair game though. Back should be treated as the escape key and not a quick exit button because it is easy to accidentally press it on honeycomb and ice cream sandwich.
4) Don't use a "do you want to quit" button when hitting back from the main menu. Just exit.
5) Don't play music on the lock screen when coming back from sleep. This one has driven us nuts trying to figure out. You have to overload onWindowFocusChanged as well as the sleep functions, and they can be called in any order.
6) Gracefully cleanup your OGL contexts.
7) For in-app purchases, don't assume your app will be open when the confirmation comes through.
8) Always have a tablet promo graphic. They scale this down to use it for feature spots on phones. This is the big banner that shows up when viewing the game on the web or on a tablet.
9) Localizing the market text is recommended, with the languages EFIGS-CJK.