Android Push Notifications with Google Cloud Messaging

We’re all familiar with the notifications that we receive from various apps on Android (even other platforms like iOS) that keeps us informed about relevant and timely events that occur in the pertaining app. Like new chat messages from WhatsApp or Emails from Gmail or a new friend request on Facebook. They’re like alerts for any important events occuring inside the app when the user hasn’t or is not using it which is sort of obvious as one won’t keep an app open and stare at it for good.

Continue reading “Android Push Notifications with Google Cloud Messaging”

Understanding Android AsyncTask (Executing Background Tasks)

The AsyncTask Android class lets us sort of bind background tasks to the UI thread. So using this class, you can perform background operations and then publish the results to the UI thread that updates the UI components. This way you won’t have to deal with threads, handlers, runnables, etc. directly yourself. It’s sort of a helper class around Thread and Handler.

Continue reading “Understanding Android AsyncTask (Executing Background Tasks)”

Android Interprocess Communication (IPC) with AIDL

Two processes cannot share memory and communicate with each other directly. So to communicate, objects have to be decomposed into primitives (marshalling) and transfered across process boundaries. To do this marshalling, one has to write a lot of complicated code, hence Android handles it for us with AIDL (Android Interface Definition Language). You should read the previous article on the binder framework to get some more idea.

Continue reading “Android Interprocess Communication (IPC) with AIDL”

Understanding Android/Java Processes and Threads Related Concepts (Handlers, Runnables, Loopers, MessageQueue, HandlerThread)

In this article we’ll try to briefly go through the various sort of low level concepts in Android that are really important to understand IMHO. Once you have a good grasp on these, a lot of things that are actually built atop these concepts become much easier to understand and code. We’ll go through processes, threads, loopers, message queues, messages, handlers, runnables, etc. I’ll also point to various external resources that you should definitely go through for a much better understanding.

Continue reading “Understanding Android/Java Processes and Threads Related Concepts (Handlers, Runnables, Loopers, MessageQueue, HandlerThread)”

Understanding Android Pending Intents

PendingIntent is basically an object that wraps another Intent object. Then it can be passed to a foreign application where you’re granting that app the right to perform the operation, i.e., execute the intent as if it were executed from your own app’s process (same permission and identity). For security reasons you should always pass explicit intents to a PendingIntent rather than being implicit.

Continue reading “Understanding Android Pending Intents”

Asynchronous Background Execution and Data Loading with Loaders (Framework) in Android

Android has this Loader framework that offers a powerful (yet simple) way to asynchronously load data from content providers or other data sources like an SQLite database, network operation, et al. in an Activity or a Fragment (clients).

Continue reading “Asynchronous Background Execution and Data Loading with Loaders (Framework) in Android”

Android ListView (Scrolling ViewGroup) Hide/Disable Scrollbars

In Android, if you’ve ever wanted to sort of disable the scrollbars of a scrolling ViewGroup like a ListView, GridView, ScrollView, etc. then there are a few tricks to do that. I’ve tried to compile a set of such tricks to disable (or just hide) scrollbars for such scrolling View Groups.

Continue reading “Android ListView (Scrolling ViewGroup) Hide/Disable Scrollbars”