IntentService
A common pattern, particularly when using AlarmManager
for scheduling periodic background work, is to have a service that implements onStart()
and forks a background thread to do the desired work. This runs the risk of forking too many threads, though, and managing your own work queue and thread pool can be annoying.
The IntentService
class wraps that pattern up for you. All you do is implement onHandleIntent()
, and Android will process all inbound Intents via a work queue on a background thread. Android will also automatically stop the service when the work queue becomes empty, to help minimize the memory footprint of your application.
Audio Playback Options
The SoundPool
class, largely undocumented in Android 1.1, is now ready for widespread use in Android 1.5. The SoundPool
is designed to play back multiple overlapping sounds, particularly useful for games. Moreover, you can specify priorities for these audio streams and a maximum number of streams, so your application can simply play back clips as needed (e.g., based on game events), and Android will ensure the maximum number of streams is not exceeded. That way, you can minimize the amount of CPU power audio playback requires.
Android 1.5 also offers AudioTrack
, whereby the device can play back audio that your code converts, perhaps from a streaming source, into PCM data. So, for example, should you want to implement a Voice-Over-IP (VOIP) application, you might use AudioTrack
to handle playback of the audio coming off of, say, the SIP connection.
Android 1.5 also introduces the JetPlayer
, designed to play back JET interactive music filesJET interactive music files.
Media Recording
Android 1.1 offered a MediaRecorder
class, but it would only record audio. Now, with Android 1.5, you can record video as well. You control the frame rate and size, along with the encoding (e.g., H.264) and output format (e.g., MP4). Android will then, on demand, record video off of the device’s camera to a file you specify.
Примечания
1
http://www.icon-king.com/?p=15
2
http://code.google.com/android/index.html
3
http://www.apress.com/book/view/1430224193
4
http://www.apache.org/licenses/LICENSE-2.0.html
5
http://ant.apache.org/
6
http://commonsware.com/Android/
7
http://code.google.com/android/reference/packages.html
8
http://droiddraw.org/
9
http://windowssdk.msdn.microsoft.com/en-us/library/ms752059.aspx