Google Android Development Agency SASS
Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

Tuesday, 1 December 2009

Tub Thumper Pro for Android out this week

At long last, we're looking at releasing Tub Thumper Pro for Android this week.

We've been into Android Development since day one and I've been constantly suprised at the amount of positive feedback we've had from the first version of Tub Thumper. We receive emails daily asking us about the pro version so I'm hoping it's going to be well received.

I'll put some more details online once it's live in the Android Market, but here's a screenshot of the sequencer interface in the meantime, which is one of the coolest new bits.


Tub Thumper Pro Sequencer Screenshot
You'll need at least Android 1.5 to run it and a touchscreen device. It's pushing the low-level audio features of Android with this tool, although I already have plans for Tub Thumper Pro 2! Watch this space...

Friday, 27 November 2009

Android AudioTrack source

I've been doing a lot of work optimising our audio playback on Tub Thumper Pro for Android this week and I constantly find myself referring back to the C++ source for the OS to help solve latency issues.

For anyone doing work with the AudioTrack object, it's worthwhile bookmarking the source online so that you can browse it whenever you hit a problem.

Here's two links I find really useful:

Incidentally, I've found that the best way of getting low-latency polyphonic audio is to subclass AudioTrack and call finalize() yourself after you're done playing; I was seeing more "write blocked for xx seconds" messages before I did this, although it may be co-incidental.

Thursday, 26 November 2009

Useful tool for building Android user interfaces

Android user interfaces are built using XML and the support for graphically laying these out in Eclipse is limited to say the least. (There are many things wrong with Visual Studio .NET but at least the UI builder is reasonably well sorted...)

A while back I came across DroidDraw - a third party tool for prototyping UIs. I think I must have had an early build back then because it had some issues, but I downloaded the latest build today and it's now hugely useful.

If you want to throw some Android user interfaces together head over to http://droiddraw.org/ and try it out. It's the tool Google should have included with the SDK!

Tuesday, 24 November 2009

Android Activity States and State Transitions

I wanted to tidy a bit of our Android code up recently to make sure that each Activity was handing it's state properly and to make sure that things were getting cleaned up when the Activity was done.

Before doing this it was important to fully understand the lifecycle of an Android Activity and to understand the state transitions that will and can occur within one.

An Android activity basically exists in one of four states:


Here's a bit more detail about each of these states:

Active
The Activity is in the foreground of the screen and is interacting with the user

Paused
The Activity has temporarily lost focus behind a new non-fullscreen or transparent Activity. In this state is retains all of it's state, however, if Android detects a low-memory situation it may be killed.

Stopped
The Activity is totally obscured behind another Activity. Again it retains it's state, but is much more likely to be killed at any point.

Finished
The Activity has been closed, either by Android or by calling finish(). The state it had dies at this point (unless you explicitly save it).


There are seven events in the Android Activity Lifecycle which give you a bit of control over what happens during each state transition.

onCreate(Bundle icicle)
Fires when the Activity is first launched. You would normally do all of your setup in this method. You can also retrieve any previously saved state from the supplied Bundle.

onStart()
Called when the Activity is becoming visible to the user, for example when another Activity higher in the stack has closed.

onRestart()
Called after the Activity has been stopped and is being restarted.

onResume()
Called when the Activity is becoming interactive to the user.

onPause()
Called when Android is about to start resuming another Activity. You would normally use this to stop anyting dynamic that is happening in your Activity, e.g sounds playing, animations happening.

onStop()
Called when the Activity is no longer visible, usually because another Activity has started over the top of it.

onDestroy()
This is the last breath of your Activity, called just before Android pulls the plug on it.

Here's a state transition diagram to show the sequence of states and the events in between:



Monday, 23 November 2009

Low latency audio playback in Android

One of the things which bugged me immensely about Android was it's lack of low-latency audio playback and a low-level audio API.

Unlike the iPhone, Android developers were stuck with high-level media player objects which basically only allowed you to chuck an MP3/OGG/Wav their way and hope for the best.

Well not any more my robot loving amigos!

After pulling my hair out trying different designs and playback algorithms working on the sequencing function of Tub Thumper Pro for Android, I finally found what I'd been looking for; an object for working with sample-level data, just like we've been doing on the iPhone.

android.Media.AudioTrack

I mean, it's not perfect, but here's what we're doing to run samples directly to the hardware without all of that mediaplayer-esque overhead (I've edited it to make it make sense outside of our app, but the theory is there):


//--load the sound file from the resource identifier into a byte array (c is Context)
InputStream s = c.getResources().openRawResource(resourceFile);
soundData = new byte[s.available()];
s.read(soundData);

//--setup an AudioTrack object, this one is running at 44.1Khz which worked best for us.
AudioTrack oTrack = new AudioTrack(AudioManager.STREAM_MUSIC, 44100,AudioFormat.CHANNEL_CONFIGURATION_MONO,AudioFormat.ENCODING_PCM_16BIT, intSize,AudioTrack.MODE_STREAM);

//--turn the audiotrack on
oTrack.play();
//--write something to the audio track, in this case the entire buffer
int playVal = oTrack.write(soundData,0,soundData.length);
//--we're turning it off here
oTrack.stop();

Our Android app in Top 100 Best Smartphone apps of all time!

Well oil my bike. Our first Android app, Tub Thumper, has just been listed in the "Hot 100 best apps" by T3 Magazine.

We still get plenty of feedback about the free version (mostly positive thankfully) and we're trying to get the Pro version out ASAP.

I'll be very interested in seeing how it runs on my Motorola Droid phone, when it arrives, given it has a multitouchscreen...

You can view the gallery here: http://www.t3.com/feature/t3s-hot-100-apps


Update - here's a shot of the app at number 1 in this months T3 magazine!

Tuesday, 28 July 2009

Get Google Latitude on UK T-Mobile G1

I don't know why, but despite the regular firmware/OS updates for Android and the G1, Google has not yet released its Latitude feature for Google maps on the UK version of the device.

Thankfully, it's dead easy to get, without requiring root access to the hardware or replacing the T-Mobile shipped OS.

To get it, all you need to do is download the "Google Maps" app from Google Market; this will replace your current Maps app with a new version, which includes Latitude.

Tuesday, 19 May 2009

New Tub Thumper Version

Today we released a minor update of our Google Android application Tub Thumper.

Tub Thumper is a touch screen drum machine for the Google Android platform and has proved immensely popular since its release last November.

This version is a minor release with a new hip-hop style drum kit, to wet people's apetites for our upcoming major release.

We've been hard at work developing Tub Thumper Pro, which will feature many new cool things. Notable assignable drum pads and the ability to sequence beats, similar to using a Roland TR-909 drum machine.

As it's not yet ready I'm not saying much more, but here's a sneak preview of assigning some drum sounds:



We're aiming this release for the Cupcake build of Android, which will have hit everyone's phones by the time we release it.

At SASS, we spend most of our time working on client projects; developing web and mobile applications for clients. It's nice to get a break from this to work on some of our own projects such as Tub Thumper and it gives us a great opportunity to try out new development ideas and increase our knowledge as developers. There does not seem to be a huge amount of Android developers around Manchester and Cheshire so it often feels like we're out on our own, but we'll continue to experiment and release new Android apps to showcase our ideas.

You can grab Tub Thumper from the Android Market. Just search, or check out the most popular Multimedia apps.

Thursday, 7 May 2009

UK G1 Owners - Get Android Cupcake early!

The rumour mill has been in full swing with regards to the early push out of Android 1.5 "Cupcake" to UK T-Mobile G1 users. Whether or not they really have started the push remains to be seen (I've not had it) but the folks over at Andblogs.net have posted how you can get it early.

First things first, grab the update: UK 1.5 Cupcake Update (CRB17) (5)


Save it to the sd card, named “update.zip”. (If you use windows, be sure you aren’t naming it something like “update.zip.zip”.) Reboot your phone in recovery mode (hold down ‘home’ while booting until you see the diamond warning.)


Now time to update! Press Alt-L. (This will turn on logging, so you can see what is going on.) Then Alt-S will apply the update.zip from the sd card. When it finishes, it’ll reboot.



I'm just trying, fingers crossed!

Oh, and don't blame me if you brick your phone, like I said - I've not tried it yet! Don't know if this works for countries other than the UK either, I'd suspect not but feel free to comment if you know otherwise.

Update!



My phone exploded in a huge fireball! Just kidding, after a nerve wracking few reboots with some cryptic logos I finally got a shiny new animating silver Android logo and I'm now smothered in delicious Cupcake.

Here are a couple of money shots:

The much-talked about touchscreen keyboard.


New homescreen icons (and check out my sweet (get it?) NIN Downward Spiral wallpaper, in your face iPhone!):


In the inimitable words of fake James Hetfield, sprinkles GOOD!

Thursday, 30 April 2009

A bit about me

Since I've had this blog for a little while now, without much background about me, I thought it might be worth sticking a post on to talk a bit about my background.

I've been working in software development for over 10 years, mostly based in and around Manchester and Cheshire.

I'm working these days as Senior Technical Architect at the Cheshire based agency SASS Digital.

I spend much of my time focusing on mobile development, notably iPhone development and Google Android development. We pioneered the Tub Thumper drum machine app on the Android platform, an app which was very successful and attracted interest from Google, HTC and T-Mobile. We're still working on Tub Thumper Pro, this will take advantage of the new audio API's of Android Cupcake so watch this space!

We've also recently been working on a top-secret audio app for the iPhone platform, I can't give away any details except to say that it's for a major client and once it's released should be awesome.

Prior to working here I was Technical Architect (amongst other things) at 3T Productions Ltd in Manchester, a sub-division of the mighty RM (Research Machines). I spent the best part of 10 years working at 3T, for huge clients such as the BBC, the DfES, Ofsted, Penguin Books and Harcourt publishing.

I gained a wealth of experience working in technologies such as ASP.NET and SQL Server and also with standards such as e-GIF and SCORM. Much of my work at 3T was e-learning based, an industry in which we broke new ground with every project.

In my spare time I play lots of guitar and record music, and spend a lot of time working on and driving rusty Citroens, such as my DS. There's a picture of my hotrod styled 2CV below.

My hotrod style 2CV

If you're interested, you can follow me on:

Twitter
Flickr

Enough about me anyway, back to the mobile development!

Friday, 24 April 2009

Problems with Android 1.5 pre release

Just been trying the pre-release of Android 1.5 and hit a problem with one of the new features of the emulator.

With this version, you can create "Android Virtual Devices" (AVDs) which allow you to run multiple configurations of the emulator side-by-side without having to run long command line switches.

I'd created my new 1.5 AVD using

android create avd --name cc --target 3 --sdcard 16M --skin HVGA

but then trying to invoke (emulator @cc) it gave the error

could not locate a virtual device named 'cc'

If you run into this problem, you can diagnose what's wrong by running

emulator -debug avd_config -avd cc

Running this gave me a weird path problem, the emulator was trying to find the .ini file for my AVD in c:\Users\Andy\ instead of e:\andy\. (I'm on Vista and my profile is on drive e:\).

To fix this, all I had to do was create a new environment variable ANDROID_SDK_HOME and point this at the moved profile directory. Restarted the command line so that it would register the variable and all was well.

Now for some Cupcake fun!

Thursday, 19 February 2009

Android RC33 for the UK coming soon

Still on RC8 in the UK
Whilst US users of the T-Mobile G1 received the latest update to Android, the so called "RC33" release earlier this month, UK users have been somewhat left in the dark, still stuck on RC8.


RC33 brings a number of cool things to Android, notably voice search and Google Latitude. Note that this isn't the long awaited "Cupcake" branch of Android - it'll be a while (if ever) until we get that on a G1.

According to a comment on this blog post, someone called T-Mobile support and was told to expect the update "sometime around February 20th".

Let's hope they're not lying - I've been developing on Android SDK 1.1 without a hardware device to test it on!

Incidentally - if you want RC33 but don't want to wait, you can follow the instructions here to get it. Don't come crying to me if you brock your phone though... ;-)

Tuesday, 17 February 2009

Second Android Handset unveiled


During this week, the Mobile World Congress has been in progress in Barcelona, and whilst we were expecting to see a whole raft of Android gubbins, it seems that the only big news is the release of the second Android-powered handset, in the form of the HTC Magic.

The Magic will be available exclusively on Vodafone and will be the first handset to feature the Cupcake branch of Android.

This is major news for us here at SASS Digital as Cupcake features signficantly improved Audio-APIs which will help no end in our ongoing development of music applications.

The big question is - will it support multi-touch? I suspect I know the answer...