Google releases Android 'Lollipop' code samples
Android 5.0, or 'Lollipop' if you prefer, is Google's biggest update yet. The latest version of the world's most-popular mobile OS ships with a whole host of new features and a radical redesign from Matías Duarte which Google wants to be adopted across the web, mobile, and desktop.
Yesterday, the Mountain View-based giant released 20 new code samples which aim to show developers how the new additions can be implemented in their own apps...
The samples can be imported into the brand-new Android Studio 1.0 using the Samples Wizard. You can access the feature by going to File > Import Sample. Once in the wizard, you can browse all of the available samples and read descriptions of their purpose. Select "Next” and the project will be automatically created. At this point, you can tinker with the code or run it on an emulator.
Another method of accessing the samples, if you're still using Eclipse for example, is through the Samples browser found on Google's developer site. Here you can download the Android 5.0 (API 21) code samples as a ZIP file to import into your own IDE.
Google's latest design language is the most user-facing change for developers to implement, and requires uptake by developers for it to succeed. Several new elements have been included in the Android 5.0 release and Google has provided code samples which make use of them to show just how great they can look in your applications...
Sample code is available for;
- Floating action button
- Reveal effect
- Drawable tinting
- Drag-and-drop with elevation
- View clipping
- Animation interpolators
Other improvements to the Android platform which developers need to take into account with Lollipop include changes to "Recent apps", "Project Volta", and the Camera API.
Recent apps is replaced by an "Overview" screen which, instead of just showing open apps, will now show instances within the app (such as separate open documents.) Google has provided sample code here which shows developers how to implement this functionality and enable users to have quicker access to specific parts of your applications.
"Project Volta" aims to address Android's battery-sucking nature, a set of new APIs and tools allow applications to be more power-efficient. The JobScheduler sample is just one example which demonstrates how to schedule background tasks to be completed later, or under specific conditions. Personal note - Please take a look at this, Facebook.
Android's camera abilities have improved thanks to the new Camera API in Lollipop which provides developers with some advanced new capture and processing abilities. Samples here aim to show developers how to use the camera preview, take photos, record video, and implement a powerful real-time HDR viewfinder.
Google's wearable platform, Android Wear, has received several major updates despite only launching in June. Improvements and new capabilities added to Wear can be hard to keep track of, but the samples provided will help you to get to grips with some of its features such as GPS support via the speed tracker sample.
Other samples available for Android Wear include;
Google's second stab at taking over the biggest screen in your home is already stirring far-more interest than its doomed predecessor. The 'Leanback library' will allow developers to declare their app is ready for TV, and provide user interface widgets for use on the big screen. A sample for its use is available here.
Pie Noon is an open-source game created in-house by Google which demonstrates multiplayer games on Android TV. The game supports several players using a variety of controllers, including touch controls on mobile devices as well as a traditional Bluetooth controller.
All the major platform holders want a place in your vehicle, and Android Auto is Google's move into this bold new era. The company might be working on driverless cars, but they're not yet ready to debut an API for that just yet...
Whilst we wait, we will have to make do with a "Media Browser" sample which demonstrates how to make an audio app compatible with Android Auto using the new Lollipop media APIs. If that doesn't whet your appetite, there's also a "Messaging" sample which will allow you to implement notifications with voice reply support.
Have you tried any of Google's new Android 5.0 code samples? Let us know in the comments.