An Overview of Android Binder Framework

In the Linux OS, there are several techniques to achieve IPC (Inter-process communication) like files, sockets, signals, pipes, message queues, semaphores, shared memory, etc. However, Android’s modified Linux kernel comes with a binder framework which enables an RPC (remote procedure call) mechanism between the client and server processes, where the client process can execute remote methods in the server process as if they were executed locally. So data can be passed to the remote method calls and results can be returned to the client calling thread. It appears as if the thread from the client process jumps into another (remote) process and starts executing in there (known as Thread Migration).

Continue reading “An Overview of Android Binder Framework”

Android Background Services with IntentService

We’ve discussed Services before that run on the application’s UI (main thread). Android provides us with IntentService (extends the Service class) that has all the properties of a Service’s lifecycle with increased process rank and at the same time allows processing tasks on a background (worker) thread. So using an IntentService you can run long-running operations in the background without affecting the app’s responsiveness and at the same time one of the biggest advantage of it is that, it isn’t affected by most of the user interface (Activity/Fragment) lifecycle events, hence continues to run even when the Activity is destroyed for instance.

Continue reading “Android Background Services with IntentService”

Working with SQLite Database (CRUD operations) in Android

We’ve covered data storage options like SharedPreferences and Internal/External Storage before. It’s time to look at another option which is basically SQLite databases. Most data-driven Android applications will need a solution to store structured (relational) data. If that’s the case then SQLite is an amazing option that Android supports out of the box. The SQLite database management classes/APIs are available in the android.database.sqlite package. We’ll learn how to create an SQLite database and then save data into it as well as retrieve, modify and delete data.

Continue reading “Working with SQLite Database (CRUD operations) in Android”

Android Push Notifications with Parse.com

Update: Parse is shutting down. So you should start migrating.

If you want to send messages upstream and downstream from your Parse backend to your app and vice-versa then thankfully Parse does allow you to do that. Parse allows you to send unlimited push notifications to 1 million unique recipients (devices). Then they charge $0.05 per 1000 recipients extra. That’s awesome!

Continue reading “Android Push Notifications with Parse.com”

Using AsyncQueryHandler to Access Content Providers Asynchronously in Android

In our previous posts we discussed SQLite access and Content Providers. Now access to a content provider will involve accessing some sort of persistent storage like a database or a file under the hood. Accessing a storage can be a long task and hence this should not be executed on the UI thread which will delay the rendering and could even lead to ANRs. Hence, background threads should be responsible for handling provider’s execution.

Continue reading “Using AsyncQueryHandler to Access Content Providers Asynchronously in Android”