Android 5 – Features


Game Devs


Android Work


Ahead-of-time (AOT) compilation

ART introduces ahead-of-time (AOT) compilation, which can improve app performance. ART also has tighter install-time verification than Dalvik.

At install time, ART compiles apps using the on-device dex2oat tool. This utility accepts DEX files as input and generates a compiled app executable for the target device. The utility should be able to compile all valid DEX files without difficulty. However, some post-processing tools produce invalid files that may be tolerated by Dalvik but cannot be compiled by ART. For more information, see Addressing Garbage Collection Issues.

Bluetooth low energy


Project Volta

In addition to new features, Android 5.0 emphasizes improvements in battery life. Use the new APIs and tool to understand and optimize your app’s power consumption.

Scheduling jobs

Android 5.0 provides a new JobScheduler API that lets you optimize battery life by defining jobs for the system to run asynchronously at a later time or under specified conditions (such as when the device is charging). Job scheduling is useful in such situations as:

  • The app has non-user-facing work that you can defer.
  • The app has work you’d prefer to do when the unit is plugged in.
  • The app has a task that requires network access or a Wi-Fi connection.
  • The app has a number of tasks that you want to run as a batch on a regular schedule.

A unit of work is encapsulated by a JobInfo object. This object specifies the scheduling criteria.

Use the JobInfo.Builder class to configure how the scheduled task should run. You can schedule the task to run under specific conditions, such as:

  • Start when the device is charging
  • Start when the device is connected to an unmetered network
  • Start when the device is idle
  • Finish before a certain deadline or with a minimum delay

For example, you can add code like this to run your task on an unmetered network:

JobInfo uploadTask = new JobInfo.Builder(mJobId,

                                         mServiceComponent /* JobService component */)



JobScheduler jobScheduler =

        (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);


If the device has stable power (that is, it has been plugged in for more than 2 minutes and the battery is at a healthy level), the system will run any scheduled job that is ready to run, even if the job’s deadline has not expired.

To see an example of how to use the JobScheduler API, refer to the JobSchedulerSample implementation sample in this release.

Further informations:

Printing Framework

Render PDF as bitmap

You can now render PDF document pages into bitmap images for printing by using the new PdfRenderer class. You must specify a ParcelFileDescriptor that is seekable (that is, the content can be randomly accessed) on which the system writes the the printable content. Your app can obtain a page for rendering with openPage(), then call render()to turn the opened PdfRenderer.Page into a bitmap. You can also set additional parameters if you only want to convert a portion of the document into a bitmap image (for example, to implement tiled rendering to zoom in on the document).

For an example of how to use the new APIs, see the PdfRendererBasic sample.

I’ve collected these informations from:

Error: failed to fetch from registry: cordova on ionic installation

vagrant@precise32:~$ sudo npm install -g cordova
npm http GET

npm ERR! Error: failed to fetch from registry: cordova
npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.onIncoming (http.js:1261:11)
npm ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR! <>
npm ERR! or use
npm ERR! reportbug --attach /home/vagrant/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "cordova"
npm ERR! cwd /home/vagrant
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: cordova
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/vagrant/npm-debug.log
npm not ok

You need to set the NPM registry

npm config set registry

Check if a service is running

private boolean isMyServiceRunning() {
    ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        if ("com.example.MyService".equals(service.service.getClassName())) {
            return true;
    return false;