Handshakes and H(W)iFi to fellow Android developers. Most of us have been already into hard core app development for Android. At times, we ought to lean towards tips and tricks of platform offerings to make our developer life easier and smart. Isn’t it?
In this post, I have listed out some of the basic hidden and interesting features available with Android. Some of us may be familiar with them, while for many of us it may tickle a spark in minds. I wish this post helps the later…
You come across an app developed using Non-Google libraries, and you want to customize it for you own needs. But there will be a hesitation whether the source code can be set & build on your development environment, thinking that you wont be able to locate the dependent libraries. The Good news is, All the source code for the platform and all the non-Google native apps are available to browse, download, borrow, or steal from the Android Open Source project.
Using the resources framework, you can create localized versions for your app just by adding a new annotated sub folder for each language that contains an XML file with strings (Eg. “values-fr” folder for French, with “strings.xml”). Android will automatically choose the right folder at run time based on the value selection.
The resources framework lets you use alternate layouts for different hardware configurations, screen pixel densities, and input devices just by dropping them in named folder. This will help to achieve device specific implementation. For example, For a device of API version 14 or below, if you wish to set specific margin, all you need to do is to create a sub folder named “values-v14” and have the styles set in the styles.xml file.
Using Intents and Intent Filters, your apps can make and serve anonymous requests for an action to be completed. Intents can request an unknown application to complete an action without the need to know the actual application that can fulfill the original request. The same is applicable vice-versa, where your app can also fulfill requests from other unknown apps without knowing the actual app from where the request initiated. Play this right and you can create the ‘default’ Twitter app, or booking app, etc.
Alarms service can be used to set your app to complete tasks at a scheduled time, 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 of 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.