Jan 8 2013

Google Play Services: Setup & Verification

WARNING: Many of the APIs used in this code have been deprecated since I initially wrote this post. Check out the official documentation for the latest instructions.

One of the trickiest aspects of writing a robust web-based Android application is authentication, simply due to its asynchronous nature and the many edge cases that one must cover. Thankfully, the recently released Google Play Services API greatly simplifies the authentication process, providing developers with a consistent and safe way to grant and receive OAuth2 access tokens to Google services. Even so, there are still several cases that must be covered in order to provide the best possible user experience. A professionally built Android application should be able to react to even the most unlikely events, for example, if a previously logged in user uninstalls Google Play Services, or navigates to the system settings and clears the application’s data when the foreground Activity is in a paused state. This post focuses on how to make use of the Google Play Services library while still accounting for edge cases such as these.

Oct 11 2012

SQLite, Content Providers, & Thread Safety

A common source of confusion when implementing ContentProviders is that of thread-safety. We all know that any potentially expensive query should be asynchronous so as not to block the UI thread, but when, if ever, is it OK to make calls to the ContentProvider from multiple threads?

Sep 16 2012

Tutorial: AppListLoader (part 4)

This will be my fourth and final post on Loaders and the LoaderManager. Let me know in the comments if they have been helpful! Links to my previous Loader-related posts are given below:

Due to public demand, I’ve written a sample application that illustrates how to correctly implement a custom Loader. The application is named AppListLoader, and it is a simple demo application that queries and lists all installed applications on your Android device. The application is a modified, re-thought (and bug-free) extension of the LoaderCustom.java sample that is provided in the API Demos. The application uses an AppListLoader (a subclass of AsyncTaskLoader) to query its data, and the LoaderManager to manage the Loader across the Activity/Fragment lifecycle:

Aug 26 2012

Follow This Blog On Google Currents!

Hi all,

I’ve recently made this blog available on Google Currents! Install the application and subscribe by clicking this link.

If you have never used Google Currents, I strongly recommend that you try it out. It’s a really great way to keep up with the latest news, blogs, and your favorite Google+ streams, and it works seamlessly offline (which I’ve found is great for long plane rides). If you’re a long time Flipboard user, I recommend you give it a try as well… in my opinion, Currents is easier to navigate and feels much more like a native Android application. That said, I do tend to be a bit biased towards the native Google apps. :P

Aug 21 2012

Implementing Loaders (part 3)

This post introduces the Loader<D> class as well as custom Loader implementations. This is the third of a series of posts I will be writing on Loaders and the LoaderManager:

First things first, if you haven’t read my previous two posts, I suggest you do so before continuing further. Here is a very brief summary of what this blog has covered so far. Life Before Loaders (part 1) described the flaws of the pre-Honeycomb 3.0 API and its tendency to perform lengthy queries on the main UI thread. These UI-unfriendly APIs resulted in unresponsive applications and were the primary motivation for introducing the Loader and the LoaderManager in Android 3.0. Understanding the LoaderManager (part 2) introduced the LoaderManager class and its role in delivering asynchronously loaded data to the client. The LoaderManager manages its Loaders across the Activity/Fragment lifecycle and can retain loaded data across configuration changes.

+1 this blog!

Android Design Patterns is a website for developers who wish to better understand the Android application framework. The tutorials here emphasize proper code design and project maintainability.

Find a typo?

Submit a pull request! The code powering this site is open-source and available on GitHub. Corrections are appreciated and encouraged! Click here for instructions.

Apps by me

2048++ is hands down the cleanest, sleekest, most responsive 2048 app for Android! Play Store