New Android SDK Tools and ADT Revision 17

Android with Screwdriver and Spanner InlaidThe Android Developers blog just announced an update for the Android SDK Tools and ADB. This new release, version 17, brings many improvements to the build process. Here are some of my favourite new features:

  • Added check for Android API calls that require a version of Android higher than the minimum supported version. This will save you from having to test your app on Android 1.6 for example, only to have it fail due to an API call that was introduced in Android 2.1
  • Added a feature that allows you to run some code only in debug mode. Builds now generate a class called BuildConfig containing a DEBUG constant that is automatically set according to your build type. You can check the (BuildConfig.DEBUG) constant in your code to run debug-only functions such as outputting debug logs.
  • Added feature to automatically setup JAR dependencies. Any .jar files in the /libs folder are added to the build configuration (similar to how the Ant build system works). Also, .jar files needed by library projects are also automatically added to projects that depend on those library projects.
  • Updated the resource chooser to show the resolved value for resources. For example, when selecting @string/hello the chooser displays a resolved value such as “Hello World”). The resource chooser also now allows you to edit the chosen value directly.

There are plenty more changes to be found in the SDK Release Notes and ADT Release Notes. The Android Emulator can now run x86 system images at native speed, thanks to contributions from Intel. Lint has also received a major upgrade, with 40 new rules checking for performance and code issues.

Read more

Intent.ACTION_SEND Crashes Facebook App

I came across a rather obscure bug today, while trying to submit my app Tap That! Number to the Amazon Appstore. I received a rejection notice detailing several problems with my app, including this strange one:

Application’s “Feedback” functionality “Facebook” option is not working.

At first I had no idea what this meant. My app never mentions Facebook at all. The only “Feedback” option I have is a menu item designed to send an email to the developer.

After digging around a bit, I found that the code I was using to launch an email intent was also recognising Facebook and presenting it in the list of available apps. Here’s the code I was using:

Read more

Live Wallpapers, and PreferenceActivity bugs

Android Live WallpaperI’ve been working on a new app lately – a CPU monitor live wallpaper for Android. There are some great tutorials & sample code out there if you’re looking at starting with live wallpapers. I recommend the Androgames tutorial, as well as the official Android documentation, and CubeLiveWallpaper sample application. Both tutorials take a slightly different approach, so make sure you understand the concepts (especially threading) thoroughly before writing your own wallpaper. I started off using the Androgames model, but then ended up completely rewriting the code to optimize battery use. The end result is much more like the CubeLiveWallpaper example.

While coding the settings screen for this app, I ran across two pretty major bugs in the current Android SDK. It seems the implementation of PreferenceActivity is quite broken, and has been for several versions of the SDK. In particular, ListPreference and CheckBoxPreference each have outstanding bugs which nearly every developer will encounter when trying to use these classes.

Read more

Development Update

The Samsung Galaxy S2 is the most popular phone in Samsung's Android lineupThis blog has been pretty quiet lately. I haven’t been able to post anything for a while due to work and study commitments. Hopefully in the next few weeks I’ll be able to get back into things, and post about my second month on the Android Market.

In the meantime, here’s a quick update on what’s been happening in the past few weeks.

Read more

AdMob Code Update Available

AdMob LogoAdMob recently released an update to the Android and iPhone SDK. Many developers have noticed a message on their “Sites & Apps” report indicating there is a “code update available“. However, AdMob don’t seem to have released a changelog or any release notes indicating what has actually changed in this latest version (v 4.1.0). So what’s the deal – should you upgrade?

Read more

First Month on the Android Market

Chart showing Android version distributionIt’s been one month now since I published my first app on the Android market. I thought this would be a great time to share some stats from the first few weeks – how many downloads, how much revenue from AdMob, user engagement figures – all that stuff. Hopefully this will give you some idea of how far I’ve come with this first app in one month, and what opportunity there is for further growth. There are plenty of screenshots, so you’ll get to see exactly what has been happening in detail.

Read more

How to add an EULA to your Android App

End User License Agreement dialog for an Android AppMany apps available on the Android Market include an End User License Agreement, or EULA. This is a simple dialog that appears when you first launch the app, and presents a licence agreement governing your use of the app. Most often, this dialog explains what information the app will collect from your phone, and how that information may be used by the developer.

Some third-party libraries such as Google Analytics require you to disclose your data collection policy to users. The most common way to do this is to present an EULA dialog when the app is first launched. So how do you make an EULA dialog? Here are a couple of tutorials to help you add a license agreement to your Android app.

Read more

Introducing: Tap That! Number

My first Android app is now published and live on the Android Market! As I mentioned in an earlier post, this is a casual game and my first attempt at integrating the AdMob SDK into an Android app.

Tap That! Number for Android
Download from the Android Market
Download from AppBrain
Download from SlideME

The aim of the game is simple – to tap all the numbers from 1 to 25 in sequence, in the fastest possible time.

This app is actually a great starting point for developing an Android game. While the concept is simple, this implementation makes use of custom views, UI themes, threading, and integration of a third-party high score system. It has several activities, and involves basic application life-cycle management (especially handling the threads).

Read more

Protecting from Cyber Attackers

Cyber attackers are constantly looking for new ways to gain access to networks. They target servers that run old and poorly-maintained software on purpose. So it’s quite unlikely that hackers will stop looking for opportunities to break into networks. However, they are finding that certain technologies, like the use of firewalls and intrusion prevention systems … Read more