What’s New for Developers in Android 4.4 KitKat
Google has released Android 4.4 (KitKat) featuring: lower memory footprint, immersive mode, translucent styles, screen printing, several frameworks – printing, storage, transitions-, Chromium WebView.
As part of the Project Svelte initiative, Google has reduced memory footprint of both the Android core, the associated frameworks and services, and the applications themselves, making it possible to run KitKat on entry-level devices with as little as 512MB of RAM, using a number of enhancements, guidelines and tools:
- OEM device manufacturers can use “Dalvik JIT code cache tuning, kernel same-page merging (KSM), swap to zRAM, and other optimizations” to lower memory consumption
- System processes now consume less heap
- System memory is protected more aggressively against apps that are using large amounts of memory
- Services are launched serially to avoid peak memory requests
- ActivityManager.isLowRamDevice() enables applications to be aware if they are running on devices with little memory so they can turn off some of the high memory consumption features
- Managing Your App's Memory is a detailed guide for developers interested in lowering the memory footprint of their applications
- The procstats tool provides details on memory usage over time, including run time, and differentiating between foreground applications and background services. The meminfo tool was enhanced to outline memory trends, and now informs on memory consumption cases that were not previously reported.
Another feature in Android 4.4 is the new “immersive mode”, the ability to run applications on the entire screen including the 3-buttons (Back, Home, Menu) area by using the flags View.SYTEM_UI_FLAG_IMMERSIVE and View.SYTEM_UI_FLAG_IMMERSIVE_STICKY, the later re-hiding the system’s bars after they have been shown for a short time when a specific event occurred. KitKat also includes translucent window styles and themes to render an application on top of a background.
In order to create tutorials, demos, marketing material, for testing purposes, etc., developers can now record the entire screen of the phone and save it as an MP4 video using
adb shell screenrecord or the DDMS panel in Eclipse or Android Studio. Those interested in protecting their content from being recorded can do so with a useSurfaceView.setSecure() call.
KitKat contains a number of new frameworks, such as:
Printing Framework – provides built-in support, API and print dialog for discovering, setting up and printing over WiFi on a local printer or via Cloud Print, enabling printing of almost “any kind of document, image or file” from all applications.
Storage Access Framework – integrates user’s local or cloud-based storage facilities, offering a standardized way to access documents across applications and storage providers. The later can include a document provider into their own Android application, being automatically integrated into the framework when the app is installed on the device, making the service available to all apps. A client application needs only to use the new
OPEN_DOCUMENT intents to be able to access the integrated storage facility.
Transitions Framework – developers can use this new framework to animate the transitions between various scenes of their UI either by choosing from a predefined set of transitions or creating their own animations.
SMS/MMS Provider – a standardized API for all application dealing with SMS/MMS messages.
Other notable new/improved features are:
RenderScript NDK – RenderScript can now be accessed directly from native code through a C++ NDK API.
The Android KitKat developer page contains a compilation of new features and enhancements, the list being too long to mention everything here. Also, the Android DevBytes contains short videos targeted at developers, introducing some of these new features.
Yoni Goldberg Oct 30, 2014
Dmytro Svarytsevych Oct 30, 2014