Sony Addon SDK

Added in API level 1

package

com.sonymobile.camera.addon.capturingmode

This project is no longer being supported and will not get any further updates.

The Camera Add-on API provides classes which manage registration for the Camera Add-on framework as well as interfaces which allow navigating the Camera Add-on UI.

Below is a block diagram of the Camera Add-on framework.

The Camera Add-on framework provides two functions:

Registration

To register your add-on, add the following information into AndroidManifest.xml of the client application.

Sample Code:


AndroidManifest.xml:
<uses-permission android:name="com.sonymobile.permission.CAMERA_ADDON"/>
 <application>
     <activity>
         <intent-filter>
             <action android:name="com.sonymobile.camera.addon.action.REGISTER_MODE"/>
         </intent-filter>
         <meta-data android:name="com.sonymobile.camera.addon.MODE_ATTRIBUTES"
             android:resource="@xml/sample_mode_attributes"/>
     </activity>
     <uses-library android:name="com.sonymobile.camera.addon.api" />
 </application>
sample_mode_attributes.xml:
<?xml version="1.0" encoding="utf-8"?>
 <modes
     xmlns:android="http://schemas.android.com/apk/res/android">
     <mode
         name="sample mode name"
         selectorIcon="drawable resource"
         selectorLabel="string resource"
         descriptionLabel="string resource"
         shortcutIcon="drawable resource"
         shortcutLabel="string resource">
         <uses-feature android:name="string"/>
      </mode>
 </modes>
In this xml file, there are two types of attributes. The first attributes are mandatory attributes, while the others are optional attributes. If mandatory attributes are not set, the mode is not registered as a add-on application. Mandatory attributes are "name", "selectorIcon", "selectorLabel" and "descriptionLabel". Optional attributes are "shortcutIcon", "shortcutLabel" and <uses-feature>.

The "name" attribute is the name of the mode. This is registered into the database of the Camera Add-on framework, but is not shown to the user. The attributes have the following restrictions:
The "selectorIcon" is the icon resource which is shown in the camera mode selector. The "selectorLabel" is the text which is shown in the camera mode selector. This text indicates the name of the mode. The "descriptionLabel" is the text which is shown in the camera mode selector. This text explains what the user can do with the mode. The "shortcutIcon" and "shortcutLabel" are shown in a view when creating a shortcut icon on the Home screen. When both "shortcutIcon" and "shortcutLabel" are set, those resources are displayed in the view. The <uses-feature> specifies the features that the client application requires. The Camera Add-on framework checks the features that the device supports and only registers the add-on if the device supports those features. Supported values are the same as the "android:name" values of Android. The value of all of the others which android supports, i.e. "android:required" and "android:glEsVersion" are ignored even if you add them here. This part can be omitted if the add-on does not require any specific device features.

Although multiple modes can be added by using <mode> tag, this is NOT recommended. In the Camera Add-on framework, the user has the ability to delete camera modes. If multiple modes in a single apk exist, the user may inadvertently delete all modes when he/she only intended to delete one.

CapturingModeSelector

This view allows you to switch to other camera modes from within your application. Please refer to CapturingModeSelector.

See Also

Interfaces

CapturingModeSelector.OnModeSelectListener Interface definition for a callback to be invoked when the user changes capturing mode to a mode which belongs to current package and activity.
CapturingModeSelector.OnModeFinishListener Interface definition for a callback to be invoked when the user changes capturing mode to a mode which belongs to different package or activity.

Classes

CapturingModeSelector This class opens and closes the capturing mode selector.