Android Debug Bridge (adb) Wireless Debugging Over Wi-Fi

We mostly connect our Android device to our computers with a USB cable for debugging purposes. It is possible to use adb over a wifi connection than a USB to save some wire-related hassles in our lives. The process is super simple, let’s go through it quickly.

Continue reading “Android Debug Bridge (adb) Wireless Debugging Over Wi-Fi”

Android/Java Multi-Threaded Execution with the Executor Framework (ThreadPoolExecutor)

These days CPUs with multiple cores have almost become the standard in Android devices. This means multiple operations (could be long running and resource intensive tasks) doesn’t have to wait to be executed on a single thread. They can rather run on multiple threads in parallel where each threads gets executed on a single processor. For example imagine an operation where multiple images have to be downloaded and shown in a gallery view. The downloads and any decoding required for different images could happen concurrently on multiple threads speeding up the entire operation, leading to a faster app experience.

Continue reading “Android/Java Multi-Threaded Execution with the Executor Framework (ThreadPoolExecutor)”

Android Push Notifications with PubNub Data Streams (via GCM)

PubNub is a SaaS platform that lets us build realtime applications fairly quick by taking implementing websockets and a neat pub/sub API based model along with several other nice features. It’s supported across all sorts of platforms that you can think of like PHP, Ruby, Python, Android, iOS, Java, embedded systems, etc. I’ve covered how to setup it’s Android SDK and the basic usage before. In this tutorial I’d like to cover how we can use it to send Push Notifications via its own REST APIs as well as Google Cloud Messaging (GCM). I’ve already covered Android messaging (showing up as Notifications) via GCM before.

Continue reading “Android Push Notifications with PubNub Data Streams (via GCM)”

Understanding Android Started and Bound Services

In Android, a Service is an application component that can perform long-running operations in the background on the UI thread. By background, it means that it doesn’t have a user interface. A Service runs on the main thread of the calling Component’s process by default (and hence can degrade responsiveness and cause ANRs), hence you should create a new Thread to perform long running operations. A Service can also be made to run in a completely different process.

Continue reading “Understanding Android Started and Bound Services”

Android Sharing Application Data with Content Provider and Content Resolver

In the previous article (must read) we discussed how basic CRUD operations can be done on SQLite in Android. An SQLite database is inherently private to the application that creates it. That means if you want some other app to access your data that won’t be possible. To solve this limitation (its more of a security measure actually), Android has the concept of Content Providers using which one app can give out constrained access to its structured set of data to other apps. So a content provider allows application to access its data which is mostly stored in an SQLite database. It is important to note that just because providers allow you to share data with other applications doesn’t mean that it cannot be used in the same application to access data.

Continue reading “Android Sharing Application Data with Content Provider and Content Resolver”

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”