DataDroid on StackOverflow
Thanks to the help of Mark Murphy, I have now created a “datadroid” tag on StackOverflow : http://stackoverflow.com/questions/tagged/datadroid
If you post a question about DataDroid on stackoverflow, remember to tag it with this tag. This way I can see and answer it when I monitor the tag.
Other information, I’ve fixed a good number of bugs recently on GitHub. I want to add a few more features and I’ll then release a new version of the library.
ParcelableCodeGenerator
A little post to present a new project of mine.
I just released a new project called ParcelableCodeGenerator which will help you to write your Parcelable classes by just having to fill a JSON file defining your fields.
The project will then generate the corresponding classes.
You can have more information about it on my main Android blog.
DataDroid version 2.1.2 is available
Version 2.1.2 is now available on GitHub
What’s new ?
- Fix some small issues with the Request object
- Add a delay before stopping the Service so that it doesn’t get recreated multiple times if you send a lot of small requests one after another
- Fix some comments
You can find the updated sample application on Google Play.
DataDroid version 2.1.1 is available
Version 2.1.1 is now available on GitHub
Why another release so soon after the previous one ? One bug with using Parcelable as a parameter for the Request object was found yesterday and as this feature is quite useful, it was worth another release.
2 other small improvements has been also added to this release.
And the sample application on Google Play has been updated as well.
DataDroid 2.1 released
I just pushed on GitHub the version 2.1 of DataDroid.
The changes are only small improvements:
- The support library was included in the project for only one class. So instead of doing that, the class itself is now included
- Improvement of the documentation in general
- Some bugfixes in the sample app
The application on Google Play has also been updated with the new version.
DataDroid v2 is available !!!
The version 2 of DataDroid is finally available !
What’s new ?
- A better architecture of the library which reduce a lot the boilerplate the developer has to write (you can check this article to see the difference)
- A more robust and easier to use API for your network connections based on HTTPUrlConnection.
- New features in the network connection API : HTTP authentication and possibility to disabled SSL validation.
- Automatic generation of a valid Android User-Agent for your requests
- Better management of calling multiple requests at the same time in your Activities (It was possible in v1.0 but not easily enough).
- The library works with API 8+ now (aka Froyo and future versions) which covers currently 97% of the user base, so it shouldn’t be a problem.
- A lot more samples available.
For a complete presentation of the library, You can check this page.
The sample application has been updated on Google Play :
And as always the source code is available on GitHub
Utilisation and migration
Whether you are a new user of DataDroid or somebody already using the v1 in your projects, you can find tutorials on how to use it and on how to migrate from v1 to v2 on this page.
Update on DataDroid v2 development and some numbers
The development of DataDroid v2 is starting to enter the final stage !!!
What to expect from version 2 of DataDroid ?
- A better architecture of the library which reduce a lot the boilerplate the developer has to write (more info on that below)
- A more robust and easier to use API for your network connections based on HTTPUrlConnection.
- Automatic generation of a valid Android User-Agent for your requests
- Better management of calling multiple requests at the same time in your Activities. It was possible before but not easily enough
- The library works with API 8+ now (aka Froyo and future versions) which covers currently 99.6% of the user base, so it shouldn’t be a problem.
Now that this is said, here are some numbers to see why it is going to be interesting as a developer to migrate from version 1 to version 2.
Before I go into detail, some context about the project I extracted the numbers :
- The project contains 22 Activities
- It uses 25 different REST webservices
- It’s going to be the first project on Google Play to use DataDroid v2. It’s my library so not really a surprise here :]
Description of the elements on the table :
- Workers/Operations :
- Workers are the v1 classes containing the code which calls the webservice and parses the result. They are now called Operations and are pretty much the same
- The increase in size is due to the fact that they include now some code which was before in the RequestManager
- Service : Same as before with less code to write. It’s the service which receives the requests and transfers them to the Workers/Operations.
- RequestManager/RequestFactory :
- RequestManager is the entry point for your request. Nothing new here except nearly all the boilerplate is done for you now.
- RequestFactory is a new class which is going to create the requests to give to the RequestManager.
- Activities : The code is now a lot cleaner than before but there is still some work to do

As you can see at the end of the table, overall there is a lot less code to write !!
In terms of time needed to do the migration, it took me around 5 hours to migrate everything. Yes it is quite some time but keep it mind that we are talking of a very big project here.
Also if you have to add new webservices in the future in your project, it’s going to be a lot more easier.
When can you expect to use it ?
So the library is done and functional. It still needs a bit more testing before releasing it.
Also I need to finish writing some samples, as well as updating the documentation.
I hope to have everything ready in 1 or 2 weeks !
ContentProviderCodeGenerator and update on DataDroid development
A little post to present a new project of mine and also give you an update on DataDroid development.
I just released a new project called ContentProviderCodeGenerator which will help you to write your ContentProviders but just having to fill a JSON file defining your tables and columns.
The project will then generate all the needed code for your project.
You can have more information about it on my main Android blog.
About DataDroid, the last update on the blog and on GitHub is from last April (which is like forever ago … sorry …)
Since then a lot of changes happened, including the new lint checks than some of you encountered which revealed some errors in the library (mainly in NetworkConnection, with the use of AndroidHttpClient which was existing in 1.6+ but not openly available until 2.2)
Due to that and also the fact that NetworkConnection is kind of a mess with the gigantic number of methods in it, I’m currently rewriting the class to use the Builder pattern (like AlertDialog.Builder works).
When this is done, NetworkConnection will be deprecated and the new NetworkConnection2 will be there to replace it with a better and more robust API.
So that’s the plan. The only missing element is the time to do it currently.
I just changed job to start working at Google in the Android team and it messed a lot my schedule as expected ![]()
But it starts to look better in term of time and I hope to have a new working version on GitHub soon !!
DataDroid usage visible on AppBrain
AppBrain added recently a page on their website showing most of the Android development libraries and the applications using them : Development Tools
After my request, they added DataDroid to the list (at the bottom, for now ^^, as it is sorted by usage) and also to see more information about it on its dedicated page
Only thing missing on the details page is the possibility to see all the apps using it and not only the top 10 but maybe it will be added in the future ![]()
DataDroid 1.0 is live
The version 1.0 of DataDroid is now available on GitHub and on Google Play.
What’s new ?
- Add a Rss Feed parser in the library that you can use in your own applications
- In case of HTTP code different from 200, a RestClientException exception is now generated and thrown.
- The RestClientException class now contains a mErrorStatus field where the HTTP status is set
- If the HTTP status received is 301 (Moved permanently), the new URL will be tried automatically. In the case of an URL loop due to multiple URL redirection, a RestClientException with a 301 error status will be thrown.
- Fix : if you didn’t provide an UserAgent as a parameter in your call to NetworkConnection, an empty one was sent with the request. You can now generate the default UserAgent by calling the following method :
- NetworkConnection.generateDefaultUserAgent(Context context)
- Check the class PocService for an example.
- Fix : The way the OnRequestFinishedListeners are removed in the RequestManager has been modified to prevent a rare crash.
You can find the example application on Google Play :
And as always the source code of the library and the application are available on GitHub
Answers to some questions I received
- Is the library ready for production ?
- I use it in every project I make which requires local or remote data. And as you can see in the Applications using DataDroid page, it’s used by several apps including for example Se Coucher Moins Bête which is used by more than 500k users
- Why does it not implement everything by itself ? Why do we need to code our parsers, etc ?
- Multiple reasons for this : first I don’t know your webservices and therefore I have no idea of how to parse it.
- The other reason is to allow to use the library in every situation :
- You don’t want to save the data in the database : you can without problem, just save it only in memory
- You don’t use XML or JSON for your webservices but an obscure format I never heard of : no problem either. As long as you can write the parser for it, you are good to go.
- You just want to use a local database and nothing else : just copy the ContentProvider classes provided in the library to your project, follow the TODO in them and you are ready !
- You have to do some work but in the end it works flawlessly and you have all the freedom you need

If you have any question about the library or how to use it in your project, feel free to leave a comment
Latest posts
Archives
- April 2013 (1)
- February 2013 (1)
- January 2013 (3)
- December 2012 (1)
- November 2012 (1)
- September 2012 (1)
- June 2012 (1)
- April 2012 (1)
- August 2011 (1)
Blogroll
