Archive for December, 2009

Android Map Tutorials Updated to v1.5 (Cupcake) – MapView & MapActivity

I updated the map tutorials to v1.5 as well.  There were enough tricky challenges to getting maps working on Android that I thought it best to pass the information along. Here are the source files for this tutorial as well as all my other tutorials.

Tutorial 1: Transparent Panel (Linear Layout) On MapView (Google Map)
Tutorial 2: “Hit” testing on a View (MapView)

The first challenge to using Google’s Maps in Android is simply informing Eclipse that you’ll need access to Google’s mapping API.  Instead of writing my own tutorial on this, I’ll simply point you to the same well-documented Android v1.5 MapActivity setup that I followed.

The second challenge as always is getting your Map API key to function properly. Google provides full details on installing your Google Map key.  I spent several hours trying to figure out why my API key wasn’t working though…my Google maps always displayed as empty white/gray tiles.  Eventually I tracked the problem down to the fact that Android had created multiple debug.keystore files on my computer.  I’m running Vista so my .keystores were located in this directory:

Correct: C:\users\<username>\.android\debug.keystore

I wasted time by using the .keystore in my AppData folder as this was the original place where the .keystores were stored in Android v1.0.  However it now seems that Android now uses the .android directory instead.  If you have problems, figure out which directory Eclipse is pulling your .keystore from when signing your apps.

Android Streaming MediaPlayer Tutorial – Updated to v1.5 (Cupcake)

After spending the last year game programming on the iPhone, I’ve finally returned to Android.  My six prior tutorials were outdated (Android v1.0) so I took the time to update them to v1.5 (Cupcake).  The most popular of those tutorials was the Streaming MediaPlayer tutorial so that’s the primary focus of this post. 

Tutorial #3 results screenshots

At the time of initially writing the streaming tutorial, Android’s media streaming function didn’t work well so I wrote my own.  As of v1.5 however, Android’s MediaPlayer streams very well.  That said, it’s still useful to know how to retrieve a media file from a server and store it on the device.  This would be useful to immediate replay of the file at a later date or for caching files for later playback ‘off the grid’.

Download the source files to get started immediately and then view the rest of the tutorial after the jump.

Continue reading ‘Android Streaming MediaPlayer Tutorial – Updated to v1.5 (Cupcake)’


a


Follow

Get every new post delivered to your Inbox.