Thursday, June 3, 2010

Android C2DM

Google recently announced a new feature for Android called C2DM. If you don't know what this feature is I suggest you watch the keynote from I/O day 2. You can read more about what C2DM actually is here.

Developers were given a chance to sign up to trail this new feature. Naturally I applied and this morning I received an email stating I had been accepted. The email mentions the account will be ready in the next day or so. Looks like I will need to wait until at least the weekend to play around with the feature.

Below is a copy of the email I received for my invite.

Thank you for your interest in Android C2DM. We've accepted your
application for the trial. We added the role account you requested to our
list, and you can start using it to send messages to Android 2.2 devices
in the next day or so.

For more information, you can read our documentation and sample code at

If you have questions or feedback, please visit the group at

If you want to change the role account used for sending messages you can
reply to this email.

AC2DM Team

Friday, May 21, 2010

Android 2.2 aka Froyo

For any developers who have been living under a rock for the past couple of days you may not know that Google have released the Froyo sdk.

Go and download it, plus make sure you check out all the exciting new features. Froyo is know as API level 8.

Monday, May 10, 2010


Yesterday I released a new application to Android Market called DigiFrame. DigiFrame is a simple application that streams Flickr photos directly to your Live Wallpaper (sorry pre 2.1 users).

You can view random images or even images related to a specific genre ie cars, sports, android etc... This evening I added support for Flickr accounts so you can view your own public photos or even other people's photos.

I'm not much of a photographer myself so I enjoy viewing the random results however viewing your photos can be quite satisfying. As you can see, the random search can return some interesting results.

The application is still in BETA so if you have any suggestions please contact me. Like wise if you find any bugs definitely let me know so I can fix them. One person reported they would like to skip photos so I added a doubletap feature to the settings screen. If you don't like the current photo simply doubletap the screen and a new photo will be displayed.

Support for other photo sites such as Picasa are coming soon. Along with an updated feature set for the Settings screen.

Finally I know the images don't scale to fit the entire screen. This is an area I'm currently debating how to handle. Personally I prefer the current letter box effect so I may add an option that allows you to choose the desired scaling method.

Saturday, May 1, 2010

Android Market Spam

Anyone who uses Android Market is well aware of the people who release 20 versions of essentially the same product. One example is releasing a sports application for each team in the competition instead of bundling them all together into one application. These people relentlessly release updates effectively burying any other product in the "Just in" category. I enjoy browsing "Just in" but damn I get finger scroll-itis when one of the offending parties releases ALL their products at once.

Well it seems we have reached a new low of spam in Android Market. One particular group have decided to spam market comments of other applications. If you have used Android Market recently you will have no doubt seen these comments. I have little faith Google will actually do anything but even if they do it is too late since the product is now in etched into the top 10.

I firmly believe they should remove them from the Market for a certain time frame, maybe a week. Clear their ranking so they can work themselves up fairly like the rest of us. But like any issue with Android Market the matter will have no official response. Even a simple "We are working on fixing x, y, z" would be helpful but don't hold your breath.

Now I am not one who usually rants since Android Market is a work in progress. I can understand technical issues take time to fix but this type of spam needs to be dealt with a swift blow. If not we'll see a whole slew of others following suit very soon.

Thursday, April 22, 2010

Android: DDMS and filtering Logcat output

One of the most useful tools in any Android developers arsenal is logcat. Type "adb shell logcat" from the command line and you will be presented with a stream of messages. This isn't particularly useful if you want to filter out all the noise and concentrate on your application logs. However, it is useful for viewing what other applications are doing. It can often be quite interesting to run applications and watch logcat. When Google first released the ADC tool allowing Android users to vote on ADC II competition entries, there was plenty of interesting output to say the least.

Google have provided an ADT plugin if you are developing for Eclipse (you may have installed this during the SDK installation). Once you have the ADT plugin installed, click in the top right corner on the plus icon near where it says "Java". Select "other" and you will be presented with a list of options.

Select "DDMS" from the list and you will have a new view available to you. You can move the panes around to suit your personal preference. Below is a snapshot of my setup.

You can also launch this tool directly from the command line. Type "ddms" from the command line and you will see the DDMS tool start (providing you have setup Android correctly on your host machine).

If you would like a thorough understanding of how to use the tool I suggest you read the DDMS documentation.

Now we have DDMS running lets go back to our original purpose, filtering out the logcat noise. In the logcat pane you will see a '+' icon. Click on this to bring up the log filter.

Give the filter a name and fill out the attributes you want to select from the logcat output. In our example we are going to grab all the "dalvikvm" messages. You will now have a new tab in the logcat view to select. This tab will only display messages that meet your criteria.

After playing around with the phone for a couple of minutes our dalvikvm tab now shows output. If we cycle back to the main logcat tab we can see all the messages except anything that matches our selection criteria.

While developing, I will have logcat running in full screen on one of my monitors. This allows me to keep an eye on what the system is doing. Make sure before you release to clean up all your logcat output. An easy solution to this is create a final boolean such as DEBUG_MODE that you can set to true/false before compiling. We have all been guilty of releasing products that output something they shouldn't. This simple feature goes a long way to cleaning that up. Not to mention is makes live much easier by only have to change a single value before releasing your application into the wild.

final static boolean DEBUG_MODE = false;

if (DEBUG_MODE) Log.i(LOG_TAG,"Load level: " + mLevel);

Having a logcat filter setup for your application will not only stop your messages getting lost amongst the system output. It will also allow you to quickly tell if you are producing any logcat output before releasing to market.

Monday, April 19, 2010

Google Analytics for Android

Did you know Google Analytics supports mobile?

Didn't think so, most developers aren't aware this powerful tool even exists for mobile. Here are the steps to implement the most basic feature of Google Analytics for Mobile.

1. Download the Google Analytics library for Android. Direct link to current version 0.7.

2. Sign up for Google Analytics if you don't already have an account.

3. Create a new UA, also known as a Web property ID. Once you are signed into Google Analytics you will see a drop down list in the top right corner. From the list, select "Create new account" and follow the steps provided. Google documentation suggests "using a fake but descriptive website URL (e.g.". Whatever you choose is entirely up to you.

4. Write down your UA. This will be generated after you complete step 3. If you forget to write it down you can view the UA by selecting the product from your analytics home screen.

5. Add the Google Analytics library to your Android project. In Eclipse right click on your project (control + click for OSX) and select Properties. Choose Java Build Path and then select the Libraries tab. Then you will need to select the Add External JARs button and navigate to where you saved the library on your computer.
Note: The exact steps may vary depending on OS and what version of Eclipse you are running.

6. Add the following permissions to your AndroidManifest.xml file.
android.permission.INTERNET & android.permission.ACCESS_NETWORK_STATE

7. Here is the very basic logic of implementing analytics.

Declare our Analytics object
public GoogleAnalyticsTracker mAnalyticsTracker;

Obtain tracker instance and start in manual mode, usually done in onCreate(Bundle savedInstanceState)
mAnalyticsTracker = GoogleAnalyticsTracker.getInstance();
mAnalyticsTracker.start("insert_UA", this);

You can also start the tracker with a dispatch interval by specifying a seconds parameter. The following code will dispatch request every 60s.
mAnalyticsTracker.start("insert_UA", 60, this);
Note: don't forget to substitute insert_UA with your actual UA account.

The Google documentation suggests using trackPageView as the best way to track which areas of your application are being viewed by users.

Say we want to track when the users view the help screen, we simply pass HelpScreen.

If we want to track when users viewed the highscore screen we would call

The string value passed to trackPageView is entirely up to you. It makes sense to give them obvious names because when you view the Analytics dashboard you want to make it simple to understand.

If you start the tracker in manual mode you will need to call dispatch() to fire off the tracking events. This call is not required if you passed a time interval to the start call.

Finally, remember to stop the tracker when you no longer need it's services.

Once you have gone through your application and implemented tracking on the desired screens, kick back and relax while analytics does it magic. From my experience the analytics dashboard is updated daily, if anyone has a definitive answer please let me know. After a couple of days you will have clear indication of what areas of your application are most frequented visited.

You may be in for a surprise as to what your users are actually doing.

The analytics download includes a sample Android project as well for you to check out

Amazed 2 Free

Amazed 2 is now available in Android Market for free. The free version is ad supported while the the non-ad version is still available for 99cents.

Amazed 2 was originally released on 15th June. The 99c version has done alright, although nothing spectacular. If I had more spare time it would definitely be worthwhile implementing some updates I have written(untested though), but for now I am relegated to bug fixes.

Hopefully the ad supported version can spur some life into the title and give me an opportunity to keep the game fresh. I am using Mobclix for my ad provider. If they work out for me, I will write-up a follow up post on how to implement them in your own applications. Likewise if they don't work out I will let you know why.

If you have any feedback for Amazed 2 please get in contact.