Header Ads

New experimental Illumination bar API available

Many people have contacted us about the API for the illumination bar available on a number of our Xperia™ smartphones, such as Xperia™ SP. And upon these requests from the developer community, we are as of today providing the Illumination API for free as an “experimental API”. This means you can experiment with illumination effects in your app in any way you like, but we will only provide limited documentation and no support. Read on to learn how to get started!
With the introduction of the Illumination bar API, we also introduce Experimental APIs as a new type of APIs. Under this label, we will make “playful” APIs available, if there is a big public demand, and if we could provide it. It could also be APIs for niche products that a small number of developers may find useful, but for which we are not able to provide extensive documentation or full support. You are free to use experimental APIs as you like, but we can’t guarantee the functionality, and we will only provide limited support.
The Illumination bar API allows developers to control the LED light illumination bar at the bottom of a number of Xperia™ smartphones (see the list of support phones below). Some of the options that can be set are the LED colour, whether or not the LED pulses and time between pulses, and various pre-defined fading patterns.  On Xperia™ SP, the LED can also be set to illuminate in rhythm with music from the audio player.
Supported phones
The following phones are fully supported by the Illumination bar API:
Xperia™ SP
Xperia™ ZL
Xperia™ ZR
Xperia™ UL
Xperia™ A
The following phones are also supported by the Illumination bar API, but the support for the pre-defined fading patterns is less extensive on these devices:
Xperia™ U
Xperia™ L
Xperia™ S
Xperia™ SL
Xperia™ P
Xperia™ sola
Xperia™ ion
Xperia™ acro HD
Xperia™ go
Xperia™ M
Xperia™ M dual
Also, for some devices (for example Xperia™ S and Xperia™ P) the hardware only supports white colour.
How to use the Illumination bar API
To add illumination effects to your app, you need to take the following steps:
Download  the IlluminationIntent.java file to the \src\com\sonyericsson\illumination directory in your Android project. Create the needed directories if they don’t exist already.
Set the illumination permission in the AndroidManifest:
"com.sonyericsson.illumination.permission.ILLUMINATION"/> 
Use the illumination intent in your Activity to create the effect you want (change com.yourapplication.packagename to the actual package name of your app):
Intent intent = new Intent(IlluminationIntent.ACTION_START_LED);
intent.putExtra(IlluminationIntent.EXTRA_LED_ID, IlluminationIntent.VALUE_BUTTON_2);
intent.putExtra(IlluminationIntent.EXTRA_PACKAGE_NAME, "com.yourapplication.packagename");
startService(intent);
If you want your app to check if a device supports the Illumination API, you can add the following code to your Activity:
Intent checkIntent = new Intent(IlluminationIntent.ACTION_STOP_LED);

 // Evaluate if we have the Illumination Service installed that can receive the intent
 if (null == getPackageManager().resolveService(checkIntent,
         PackageManager.GET_RESOLVED_FILTER)) {
        //  Not supported
}
As you can see, it is really easy to add illumination effects to your app. So have a look at the Illumination bar API page, where you will find all the information we provide about this API, including specifications of the pre-defined fading patterns. If you create an app using this API, we would be happy to hear from you. Just drop us a comment below.
Develop apps for Sony devices with the Sony Add-on SDK
The Sony Add-on SDK is the official SDK for Sony’s mobile Android devices, and it includes a number of different APIs, emulator, code examples and extensive documentation. You can for example develop apps for SmartWatch, create your own Small Apps and much more. Learn more in the Sony Add-on SDK section.
What other APIs would you like us to release? Drop us a comment and let us know.

No comments:

Powered by Blogger.