Google has just released the source code of the app that they made available to help people attend and generally manage I/O 2014. The idea is that this is an example of good practice for Android developers to take note of.
The idea of showcasing code so that developers can learn how to do the job properly isn't new, but this is an example of a big and very real program.
It might not be the best place to start trying to understand Android, but if you are working on an app that might grow as big then it makes interesting reading.
The Developers Blog says:
"In addition to showing how to implement a wide variety of features that are useful for most Android apps, such as Fragments, Loaders, Services, Broadcast Receivers, alarms, notifications, SQLite databases, Content Providers, Action Bar and the Navigation Drawer, the I/O app source code also shows how to integrate with several Google products and services, from the Google Drive API to Google Cloud Messaging. It uses the material design approach, the Android L Preview APIs and full Android Wear integration with a packaged wearable app for sending session feedback."
You will notice that this is an app in the new material design style and you will need the Android L Preview and Android Studio to make sense of the code. Another interesting choice is that it makes use of Android Studio and Gradle. Unfortunately the development team seem to be a Gradle ahead of the rest of us because the project demands a newer version when you load it. You can download the a zip of the project from GitHub and simply import the project into Android Studio making sure you have the updated tools installed.
If you want to do more than just read though the code you will have to provide a simple service to supply the app with data. To make this easier it has been modified to read JSON files containing the data and this means you don't have to implement a server with a specific API. How to do this is documented.
You can also download and install the original app from the Play store which at least gives you an easy way to find out what it actually does before trying to understand the code.
The big problem with the entire example is its lack of detailed documentation or tutorial oriented comments. You can find examples where something is done in a particular way and not really know why. For example, the implementation of the interface pattern callback in the Fragments the code is written to retrieve the method each time it is used. The standard Fragment documentation shows it being retrieved once and stored for reuse. It's small difference and you can work out for yourself that storing it for reuse is slightly more efficient, but what if the stored reference changes?
The good news is that we are promised some technical articles explaining how it all works. plus the code is going to be updated for each year's Google I/O, so it will become a living reference.
Intel unveiled a virtual reality headset that allows nearby objects from the real world to be integrated into its computer-generated views at this week's Intel Developer Forum. Project Alloy is at an [ ... ]