Android – Hidden features of Android development

androidhidden-features

I am surprised that there is no Android Hidden Features post yet in the Hidden Features series that I've been tracking for a while now.

The Hidden Features series is great for people who are new to a certain language. It shows the ropes and certain valuable tricks, all in one place. I think it's a brilliant idea. Even experts sometimes find tricks they'd never heard about.

I am starting Android development and I'd love to hear about its hidden features, tips, tricks, and pitfalls.

So, here goes: what are some hidden features of Android?

Best Answer

Hopefully there aren't too many hidden, hidden features - but here's some of the less well known and non-intuitive features available for Android that will definitely make your life easier and your apps better.

  • All the source code for the platform and all the non-Google native apps is available for you to browse, download, borrow, or steal from the Android Open Source project.
  • Using the resources framework, creating localized versions of your app is as simple as adding a new annotated subfolder (Eg. values-fr) that contains an XML file with strings in a different language (Eg. French). Android will choose the right folder at runtime for you.
    • The same resources framework lets you use alternate layouts for different hardware configurations, screen pixel densities, and input devices just by dropping them in named folder.
  • Since Android 1.6, your app can produce results that will appear in the results from a homescreen Quick Search Box search. This is known as custom search suggestions.
  • Using Intents and Intent Filters your apps can make and service anonymous requests for an action to be completed (Eg. The Where app can request a table booking from the Open Table app).
    • They can request an unknown application to complete an action without needing to know which application(s) can fulfill that request
    • Your app can fulfill requests from unknown apps to complete actions without needing to know which apps will make the requests. Play this right and you can create the 'default' Twitter app, or booking app, etc.
  • Using Alarms you can set your app to complete tasks at predetermined times, even if your app isn't running.
    • You can save a lot of battery life using the setInexactRepeating method to schedule regular events (like server polling or updates). It will synchronize alarms from multiple apps to occur at the same time rather than adhoc.
  • Using the Preferences framework you can create settings screens for your apps in the same style as the system settings. You can even incorporate system settings screens (Eg. Security and Location) into your application's settings hierarchy.
  • Using the AudioTrack and AudioRecord APIs, you can stream audio data directly from and to the PCM audio buffers.