If there is one thing I've learned from working in the technology industry for more than a decade, it's that the key to fixing any issue is reproducing it. It doesn't matter if you're talking about electrical, mechanical, or software engineering — until you can consistently reproduce a bug or malfunction, any change you affect is nothing more than a guess.
I've never been good at guessing games, (I can count the number of times I've been victorious at rock, paper, scissors on one hand). So when I recently had a handful of users reporting the dreaded "this application has stopped unexpectedly" error, I looked hard for the common thread uniting the users experiencing the issue. I attempted to cover all my bases: phone manufacturer, model, memory, OS version, and I even checked out the carriers.
It was when I noted the carrier that I realized I'd missed something obvious. Armed with a strong hunch (and some troubleshooting best practices), I flipped the Language & Keyboard setting on my phone from English to Deutsch. Kapow! The app crashed in a spectacular fashion.
The smartphone app ecosystem is a global one. I'm certainly not a n00b when it comes to targeting code at a multinational consumer base, but quite frankly, it can be tough. Even if you choose to only support one language, you can still feel the painful sting of a localization bug.
I've compiled some tips for making sure your Android app is up to muster in the global ecosystem. The list is not all inclusive, and includes items that apply to Java coding in general, as well as things that are specific to the Android OS and Google's Marketplace.
Know who can download your appWhen you publish an app in the Google Marketplace, you get to choose which countries your app can be downloaded from (Figure A). The more customers you can reach the better, but if you know your app won't work in a particular region, it's better to block users from seeing it there than risk the negative feedback. You can always go back and edit these settings in the future when you've had time to thoroughly test your app with a given language and keyboard setting. Figure A
Don't hardcode strings!
The tip to avoid hardcoded strings may be obvious to seasoned developers, but those new to Android or coding in general may not have been told this information. Yes, in examples and tutorials (including the ones I write for TechRepublic), you will frequently see hardcoded strings like:
However, this is done in tutorials for simplicity only. You should retrieve any string you plan to expose to your users from a resource file like this:
editText.setText(getString(R.string.some_text));Get more tips on developing for the Android global marketplace.
William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intelligence Corps. Throughout his career William has published numerous technical articles, as well as the occasional short story.