Skip to content
Easy integration with Android's built-in and custom content providers data
Branch: master
Clone or download
Latest commit b81beb8 Mar 1, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Update dependencies Aug 14, 2015
gradle/wrapper Update build gradle Aug 13, 2015
providers-android Update Feb 29, 2016
providers-core Update build gradle Aug 13, 2015
providers-stetho Update gradle dependencies Aug 14, 2015
.gitignore Initial commit Aug 6, 2015 Update Aug 21, 2015
build.gradle Initial commit Aug 6, 2015 Initial commit Aug 6, 2015
gradlew Initial commit Aug 6, 2015
gradlew.bat Initial commit Aug 6, 2015
settings.gradle Initial commit Aug 6, 2015

Easy Content Providers

Easy integration with Android's built-in and custom content providers data. It even comes with a Sample app and Stetho extension for debugging purposes.

Android Arsenal

Why and When

We often experiment with new features, new apps, new ideas or we just code through a hackathon project that's built on-top of Android's content providers.. In such cases, we need tools to get what we want with minimum friction. This is where easy-content-providers come in - we can get all android stored data very easily and we can debug results through Chrome dev tools (based on Stetho implementation).

The library uses reflection and some additional operations to make the ORM implementation generic, this is great for flexibility and POCs but might not be sufficient for high performance production apps. Also, if you don't define the exact columns you want, the mapping will happen on all columns (select * from ...). Sometimes, this is not what you want.

Example Usage


dependencies {
    compile 'me.everything:providers-android:1.0.1'

Getting all calendars:

CalanderProvider provider = new CalendarProvider(context);
List<Calendar> calendars = provider.getCalendars().getList();

Full documentation can be found at the wiki.

Inspecting provider data


dependencies {
    compile 'me.everything:providers-stetho:1.0.1' 

Leveraging Stetho's ability to inspect SQLite databases, you can visualize, explore and modify all provider data.


In the above example, all providers can be seen expanded, "provider-calendar" is selected and it's items appear in the table to the right.

Adding your own providers

And of course, you can see your own providers by registring them. In our example (check sample app):

providersStetho.registerProvider("provider-custom", "posts", new ProvidersStetho.QueryExecutor<Post>() {
    public Data<Post> onQuery(String query) {
        PostsProvider provider = new PostsProvider(getApplicationContext());
        return provider.getPosts();

Which looks like so:


SQL Quering

Stetho allows to query SQLite databases from within it's console. Currently, Android providers are interactable with sql, with the following limitations:

  • Only all-inclusive queries are possible select * from "tablename"

  • Results may take a few seconds to appear.

  • Querying tables in provider-calendar can only be done like so:

    • #events:id=3 - select from events where calendar id = 3
    • #instances:id=100 - select from instances where event id = 100
    • #reminders:id=100 - select from reminders where event id = 100
    • #attendees:id=100 - select from attendees where event id = 100


We are inclined to rid ourselves of these limitations. Stay tuned for upcoming developments.

Sample App

Try it out with our sample app. Download the apk, run it on a connected device, open chrome://inspect in Chrome and start inspecting the providers to your delight.

Notice the app lists items from each provider. Take a look at the app's source code to see how this was implemented.



Roman Kushnarenko - sromku


Apache License 2.0

You can’t perform that action at this time.