Android 5.0 (Lollipop) comes with a large number of new APIs, over 5,000 of them, according to Ankur Kotwal, a Google developer advocate. These cover many areas of mobile development from the new Material Design, to enhanced battery management, to managing devices to ART. We are presenting some of the most important.
Material Design. We covered this in greater detail in an earlier post, so we won’t do it here. We will mention though that a number of widgets and support libraries have been provided to facilitate Material Design for older devices. After an app has been tested and everything works fine on Android 5.0, it can be upgraded to Material Design using these guidelines.
Heads-up Notifications. High priority notifications using ringtones or vibrations can now be shown on top of the user’s full screen activity along with possible actions to be taken.
Lock Screen Notifications. If the user enables notifications on the lock screen, apps can display such information on a device’s secured screen, messages being categorized as Private – shows just a part of the message or an edited version of it-, Public –shows the entire message-, or Secret – shows nothing.
WebView has been upgraded to Chromium 37, including support for WebAudio, WebGL, and WebRTC. The onShowFileChooser()
method can be used to upload files from devices. WebView can now access the camera and microphone providing it receives the user’s acceptance.
Users will no longer have to wait for WebView updates in the future because Google will auto-update it through Google Play as it does with Play Services. That means frequent updates and latest features.
Project Volta enables developers to understand how their app uses power showing them when and how much power it consumes. With the new JobScheduler API, devs can decide when to schedule a job to be run: when the device is idle, when connected to an unmetered network, when charging or before a specified deadline.
ART. The Runtime experimentally introduced with Android 4.4 is now made the default way to run applications. ART provides compilation ahead-of-time, better garbage collection than Dalvik and better debugging. According to Google, it can improve an app’s performance without having to perform any code changes.
Some applications may not work on ART if they are using JNI to run C/C++ code, if the code is processed by some obfuscators or uses incompatible compacting GC techniques. For more details see Verifying App Behavior on the Android Runtime (ART).
64-bit. The NDK r10c adds support for 64-bit programming, offering a larger address bus, more processor registers and more instruction sets, all translating into better performance for applications optimized for it. The SDK r23 includes a 64-it emulator. 32-bit Java applications will run on 64-bit without any change.
Android Work. IT administrators can install and administer applications on devices that can be shared between personal and job related activities. While administrators have complete access over the apps and data they set up, the user has control over the apps he installs. The data is also separated between the two profiles. In spite of security and administrative measures governing BYOD devices, the user gets a unified experience across personal and work related information. There is only one app launcher, and there is no need to switch between profiles to access documents or notifications.
Camera2 API replaces the Camera
class which has been deprecated. According to the documentation, Camera2
models a camera device as a pipeline, which takes in input requests for capturing a single frame, captures the single image per the request, and then outputs one capture result metadata packet, plus a set of output image buffers for the request. The requests are processed in-order, and multiple requests can be in flight at once. Since the camera device is a pipeline with multiple stages, having multiple requests in flight is required to maintain full framerate on most Android devices.
Devices meeting the specs can now capture uncompressed YUV footage at a resolution of 8MP at 30 FPS.
Game Development. Android 5.0 includes support for OpenGL ES 3.1 which includes compute shaders, separate shader objects, indirect draw commands, multi-sample and stencil textures, shading language improvements, extensions for advanced blend modes and debugging, and it is backwards compatible with ES 2.0 and 3.0. Added functionality is provided with the Android Extension Pack which includes Java interfaces and native support for more complex graphics operations.
Connectivity. Android 5.0 monitors the wireless space to discover available networks in order to connect to them when necessary. This is useful when an app requires the use of a specific network (MMS, SUPL, carrier-billing, etc.) or a specific connection protocol.
Bluetooth LE Peripheral Mode lets applications behave like sensors – pedometers, health monitoring, etc., broadcasting collected data and transferring it to other devices.
The new SDK, ADT, emulator (32-bit & 64-bit x86 and Android TV 32-bit) and NDK r10c have been made available, including preview system images for Nexus 5 and Nexus 7. In early November, Nexus 6, Nexus 9, and Nexus Player will hit the stores preloaded with Lollipop, while Nexus 4, 5, 7 (2012 & 2013), 10 other unspecified devices, and Google Play edition devices will receive the upgrade.