Sony Addon SDK
public static interface

Widget.Intents

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

Class Overview

Intents sent between Widget extensions and Accessory Host Applications.

Summary

Constants
java.lang.String WIDGET_START_REFRESH_IMAGE_INTENT Intent sent by the Accessory Host Application whenever it wants the Widget to start updating it's Widget image.
java.lang.String WIDGET_STOP_REFRESH_IMAGE_INTENT Intent sent by the Accessory Host Application whenever it wants the Widget to stop/pause updating it's Widget image.
java.lang.String WIDGET_PROCESS_LAYOUT_INTENT Intent sent by the extension whenever it wants to update the Accessory display by sending an XML layout.
java.lang.String WIDGET_IMAGE_UPDATE_INTENT Intent used by the Widget extension whenever it wants to update its widget image.
java.lang.String WIDGET_ENTER_NEXT_LEVEL_INTENT This intent may be used by the Widget extension as a response to a WIDGET_ONTOUCH_INTENT.
java.lang.String WIDGET_ONTOUCH_INTENT Intent sent by the Host Application to the Widget extension whenever a user interacts with the Widget image.
java.lang.String WIDGET_OBJECT_CLICK_EVENT_INTENT Intent sent by the Host Application to the Widget extension whenever an click event is detected on a graphical object referenced from a layout.
java.lang.String WIDGET_SEND_IMAGE_INTENT Intent sent by the Widget extension whenever it wants to update an image in an ImageView on the accessory.
java.lang.String WIDGET_SEND_TEXT_INTENT Intent sent by the Widget extension whenever it wants to update a text in a TextView on the accessory.
java.lang.String EXTRA_AHA_PACKAGE_NAME The name of the Intent-extra used to identify the Host Application.
java.lang.String EXTRA_AEA_PACKAGE_NAME The name of the Intent-extra used to identify the extension.
java.lang.String EXTRA_WIDGET_IMAGE_URI The name of the Intent-extra used to identify the URI of the Widget image.
java.lang.String EXTRA_WIDGET_IMAGE_DATA The name of the Intent-extra used to identify the Widget image.
java.lang.String EXTRA_EVENT_TYPE The name of the Intent-extra used to identify the touch event
java.lang.String EXTRA_EVENT_X_POS The name of the Intent-extra used to carry the X coordinate of the touch event
java.lang.String EXTRA_EVENT_Y_POS The name of the Intent-extra used to carry the Y coordinate of the touch event
java.lang.String EXTRA_EXTENSION_KEY The name of the Intent-extra containing the key set by the extension in EXTENSION_KEY.
java.lang.String EXTRA_DATA_XML_LAYOUT The name of the Intent-extra used to identify the data XML layout to be processed by the host application and displayed by the accessory.
java.lang.String EXTRA_LAYOUT_REFERENCE The name of the Intent-extra used to identify a reference within an extension.
java.lang.String EXTRA_WIDGET_TEXT The name of the Intent-extra used when sending a text (String) from the extension to the accessory.
java.lang.String EXTRA_KEY The name of the intent extra used to identify a widget in case the extension supports several different widgets.
java.lang.String EXTRA_LAYOUT_DATA Data used to populate the views in a XML layout with dynamic info.
java.lang.String EXTRA_ADDITIONAL_LAYOUTS Data used to add state specific layouts to a widget.
java.lang.String EXTRA_ACCESSORY_STATE Specifies the accessory state that a given resource is applicable for
java.lang.String EXTRA_INSTANCE_ID Specifies the widget instance.
int EVENT_TYPE_SHORT_TAP The event type is a short tap.
int EVENT_TYPE_LONG_TAP The event type is a long tap

Constants

Added in API level 1.0 public static final java.lang.String WIDGET_START_REFRESH_IMAGE_INTENT

Intent sent by the Accessory Host Application whenever it wants the Widget to start updating it's Widget image. Usually this Intent will be sent out when the accessory just starts and is about to show the Widget menu. The Widget image should be updated as soon as possible and after the initial update the Widget image should be updated occasionally until WIDGET_STOP_REFRESH_IMAGE_INTENT is received.

The EXTRA_INSTANCE_ID specifies the widget instance and is used in all subsequent intents to and from that widget instance.

Intent-extra data:



Constant Value: "com.sonyericsson.extras.aef.widget.START_REFRESH_IMAGE_REQUEST"

Added in API level 1.0 public static final java.lang.String WIDGET_STOP_REFRESH_IMAGE_INTENT

Intent sent by the Accessory Host Application whenever it wants the Widget to stop/pause updating it's Widget image. The Widget should resume updating its image when WIDGET_START_REFRESH_IMAGE_INTENT is received.

Intent-extra data:



Constant Value: "com.sonyericsson.extras.aef.widget.STOP_REFRESH_IMAGE_REQUEST"

Added in API level 2.0 public static final java.lang.String WIDGET_PROCESS_LAYOUT_INTENT

Intent sent by the extension whenever it wants to update the Accessory display by sending an XML layout.

EXTRA_LAYOUT_DATA can be used to populate views in the layout with initial values. The content of the views in the layout can also be updated using WIDGET_SEND_TEXT_INTENT and WIDGET_SEND_IMAGE_INTENT.

When using the broadcast queue, this intent should be sent with enforced security by supplying the host application permission to sendBroadcast(Intent, String). HOSTAPP_PERMISSION

Intent-extra data:



Constant Value: "com.sonyericsson.extras.aef.widget.PROCESS_LAYOUT"

Added in API level 1.0 public static final java.lang.String WIDGET_IMAGE_UPDATE_INTENT

Intent used by the Widget extension whenever it wants to update its widget image. The Widget image should be updated occasionally. If the extension tries to update its Widget image to often, the Host Application will ignore the requests.

When using the broadcast queue, this intent should be sent with enforced security by supplying the host application permission to sendBroadcast(Intent, String). HOSTAPP_PERMISSION

Intent-extra data:



Constant Value: "com.sonyericsson.extras.aef.widget.IMAGE_UPDATE"

Added in API level 1.0 public static final java.lang.String WIDGET_ENTER_NEXT_LEVEL_INTENT

This intent may be used by the Widget extension as a response to a WIDGET_ONTOUCH_INTENT. The widget should send this intent when it does not want to perform any action based on the on touch intent. When receiving this intent the host application is free to stop interaction with this widget and enter a new level or state internally.

When using the broadcast queue, this intent should be sent with enforced security by supplying the host application permission to sendBroadcast(Intent, String). HOSTAPP_PERMISSION

Intent-extra data:



Constant Value: "com.sonyericsson.extras.aef.widget.ENTER_NEW_LEVEL"

Added in API level 1.0 public static final java.lang.String WIDGET_ONTOUCH_INTENT

Intent sent by the Host Application to the Widget extension whenever a user interacts with the Widget image. Usually as a result of this Intent the Widget extension will update its Widget image and take appropriate action

Intent-extra data:



Constant Value: "com.sonyericsson.extras.aef.widget.ONTOUCH"

Added in API level 2.0 public static final java.lang.String WIDGET_OBJECT_CLICK_EVENT_INTENT

Intent sent by the Host Application to the Widget extension whenever an click event is detected on a graphical object referenced from a layout.

Intent-extra data:



Constant Value: "com.sonyericsson.extras.aef.widget.OBJECT_CLICK_EVENT"

Added in API level 2.0 public static final java.lang.String WIDGET_SEND_IMAGE_INTENT

Intent sent by the Widget extension whenever it wants to update an image in an ImageView on the accessory. The image can be a URI or an array of a raw image, like JPEG The image will replace any previous sent image with the same reference.

When using the broadcast queue, this intent should be sent with enforced security by supplying the host application permission to sendBroadcast(Intent, String). HOSTAPP_PERMISSION

Intent-extra data:



Constant Value: "com.sonyericsson.extras.aef.widget.SEND_IMAGE"

Added in API level 2.0 public static final java.lang.String WIDGET_SEND_TEXT_INTENT

Intent sent by the Widget extension whenever it wants to update a text in a TextView on the accessory. The text will replace any previous sent text with the same reference.

When using the broadcast queue, his intent should be sent with enforced security by supplying the host application permission to sendBroadcast(Intent, String). HOSTAPP_PERMISSION

Intent-extra data:



Constant Value: "com.sonyericsson.extras.aef.widget.SEND_TEXT"

Added in API level 1.0 public static final java.lang.String EXTRA_AHA_PACKAGE_NAME

The name of the Intent-extra used to identify the Host Application. The Host Application will send its package name

TYPE: TEXT

Constant Value: "aha_package_name"

Added in API level 1.0 public static final java.lang.String EXTRA_AEA_PACKAGE_NAME

The name of the Intent-extra used to identify the extension. The extension will send its package name

TYPE: TEXT

Constant Value: "aea_package_name"

Added in API level 1.0 public static final java.lang.String EXTRA_WIDGET_IMAGE_URI

The name of the Intent-extra used to identify the URI of the Widget image. If the image is in raw data (e.g. an array of bytes) use EXTRA_WIDGET_IMAGE_DATA instead. The image is displayed in the Widget row on the Accessory display. The image can be updated by the extension at a later stage

TYPE: TEXT

Constant Value: "widget_image_uri"

Added in API level 1.0 public static final java.lang.String EXTRA_WIDGET_IMAGE_DATA

The name of the Intent-extra used to identify the Widget image. This Intent-extra should be used if the image is in raw data (e.g. an array of bytes). The image is displayed in the Widget row on the Accessory display. The image can be updated by the extension at a later stage

TYPE: BYTE ARRAY

Constant Value: "widget_image_data"

Added in API level 1.0 public static final java.lang.String EXTRA_EVENT_TYPE

The name of the Intent-extra used to identify the touch event

TYPE: INTEGER (int)

ALLOWED VALUES:



Constant Value: "widget_event_type"

Added in API level 1.0 public static final java.lang.String EXTRA_EVENT_X_POS

The name of the Intent-extra used to carry the X coordinate of the touch event

TYPE: INTEGER (int)

Constant Value: "widget_event_x_pos"

Added in API level 1.0 public static final java.lang.String EXTRA_EVENT_Y_POS

The name of the Intent-extra used to carry the Y coordinate of the touch event

TYPE: INTEGER (int)

Constant Value: "widget_event_y_pos"

Added in API level 1.0 public static final java.lang.String EXTRA_EXTENSION_KEY

The name of the Intent-extra containing the key set by the extension in EXTENSION_KEY. This Intent-data is present in all Intents sent by accessory host application, except where startActivity(android.content.Intent) is used. See section Security for more information

Constant Value: "extension_key"

Added in API level 2.0 public static final java.lang.String EXTRA_DATA_XML_LAYOUT

The name of the Intent-extra used to identify the data XML layout to be processed by the host application and displayed by the accessory. The layout resource id is used to identify the layout.

This is a standard Android layout, where a subset of the Android views are supported.



Dimensions

The px dimensions is the only dimension supported.

ViewGroups

The following ViewGroups are supported:

  • AbsoluteLayout
  • FrameLayout
  • LinearLayout
  • RelativeLayout
All XML attributes are supported for the supported ViewGroups.

Views

The following Views are supported:

  • View
  • ImageView
  • TextView
An accessory may support only a subset of these layouts. LAYOUT_SUPPORT specifies which Views that are supported for a certain accessory.

The following View XML attributes are supported

  • android:background - can be a solid color such as "#ff000000" (black) or a StateListDrawable with solid colors. Only the android:state_pressed attribute of the StateListDrawable is supported. Using a StateListDrawable requires that the view has at least one of android:clickable or android:longClickable set to true.
  • android:clickable - WIDGET_OBJECT_CLICK_EVENT_INTENT are sent for short clicks views where this flag is set to true
  • android:longClickable - WIDGET_OBJECT_CLICK_EVENT_INTENT are sent for long clicks views where this flag is set to true
  • android:id
  • android:padding
  • android:paddingBottom
  • android:paddingLeft
  • android:paddingRight
  • android:paddingTop


ImageView

For an ImageView the following XML attributes are supported

  • android:src - can be a BitmapDrawable or a NinePatchDrawable
  • android:scaleType


TextView

For a TextView the following XML attributes are supported

  • android:ellipsize - can be none, start, middle or end
  • android:gravity
  • android:lines
  • android:maxLines
  • android:singleLine
  • android:text
  • android:textColor
  • android:textSize - Not all text sizes are supported by all accessories. If a not supported text size is used the accessory will select the closest available text size. See the accessory white paper for a list of supported text sizes.
  • android:textStyle


TYPE: INTEGER

Constant Value: "data_xml_layout"

Added in API level 2.0 public static final java.lang.String EXTRA_LAYOUT_REFERENCE

The name of the Intent-extra used to identify a reference within an extension. The extension may use the same reference in multiple layouts. A reference is a text or an image owned by the extension and will be used to map between layouts and images/texts. Corresponds to the android:id XML attribute in the layout.

TYPE: INTEGER

Constant Value: "layout_reference"

Added in API level 2.0 public static final java.lang.String EXTRA_WIDGET_TEXT

The name of the Intent-extra used when sending a text (String) from the extension to the accessory. The accessory will map the text to a layout reference.

TYPE: STRING

Constant Value: "text_from extension"

Added in API level 3.0 public static final java.lang.String EXTRA_KEY

The name of the intent extra used to identify a widget in case the extension supports several different widgets. The extension specifies this in KEY.

TYPE: STRING

Constant Value: "key"

Added in API level 3.0 public static final java.lang.String EXTRA_LAYOUT_DATA

Data used to populate the views in a XML layout with dynamic info. For example updating a TextView with a new text or setting a new image in an ImageView. EXTRA_LAYOUT_REFERENCE specifies the view to be updated and one of EXTRA_WIDGET_TEXT, EXTRA_WIDGET_IMAGE_URI and EXTRA_WIDGET_IMAGE_DATA specifies the new information in the view.

TYPE: Array of BUNDLEs with following information in each BUNDLE.



Constant Value: "layout_data"

Added in API level 3.0 public static final java.lang.String EXTRA_ADDITIONAL_LAYOUTS

Data used to add state specific layouts to a widget. EXTRA_DATA_XML_LAYOUT specifies the XML layout and EXTRA_ACCESSORY_STATE specifies the state in which the provided layout is relevant. If no state specific resources are supplied, the resource provided at EXTRA_DATA_XML_LAYOUT is used. If no resource is provided for either POWERSAVE or DISCONNECTED, the DEFAULT resource is used.

TYPE: Array of BUNDLEs with following information in each BUNDLE.



Constant Value: "additional_layouts"

Added in API level 3.0 public static final java.lang.String EXTRA_ACCESSORY_STATE

Specifies the accessory state that a given resource is applicable for

TYPE: INTEGER (int), see Widget.AccessoryState.

Constant Value: "display_mode"

Added in API level 3.0 public static final java.lang.String EXTRA_INSTANCE_ID

Specifies the widget instance.

TYPE: INTEGER

Constant Value: "instance_id"

Added in API level 1.0 public static final int EVENT_TYPE_SHORT_TAP

The event type is a short tap.

Constant Value: 0 (0x00000000)

Added in API level 1.0 public static final int EVENT_TYPE_LONG_TAP

The event type is a long tap

Constant Value: 1 (0x00000001)