Sony Addon SDK public class

Tunnel

This project is no longer being supported and will not get any further updates.
extends java.lang.Object
  1. java.lang.Object
  2. com.sonyericsson.extras.liveware.aef.tunnel.Tunnel

Class Overview

Tunnel API is a part of the SmartExtension APIs.

For all time sensitive user interactions extensions need to communicate with the accessory with foreground priority. This API enables an host application to bind to an extension service and exchange a pair of Messenger objects allowing for a two way communication using a simple intent tunneling protocol. The extension service will have foreground priority as long as a host application is bound to it.

Life cycle of a tunnel

The host application should open a tunnel when it is about to send an intent and it finds a service in the extension package exposing ACTION_BIND through its intent-filters, as the example below.
An opened tunnel should remain open until the service stops itself.

Enabling tunnel support in the manifest


<service android:name="com.sonyericsson.extras.liveware.extension.util.TunnelService">
   <intent-filter>
     <action android:name="com.sonyericsson.extras.liveware.aef.tunnel.action.BIND" />
   </intent-filter>
 </service>

The Accessory Connection Intent

The ACCESSORY_CONNECTION_INTENT should by default always be sent over the broadcast queue preventing the extensions from gaining foreground priority at startup. Raising the priority on all extensions could strain devices with limited memory.

It is possible to override the default behavior by adding the connection intent action in the tunnel service filter like the example below. This should only be used when really necessary. An example of this is a call application which takes control over the accessory screen when there is an incoming call. A user hearing the ringing on his host device expects the watch to immediately show the call control as soon as it gets in range.


<service android:name="com.sonyericsson.extras.liveware.extension.util.TunnelService">
   <intent-filter>
     <action android:name="com.sonyericsson.extras.liveware.aef.tunnel.action.BIND" />
     <action android:name="com.sonyericsson.extras.liveware.aef.registration.ACCESSORY_CONNECTION" />
   </intent-filter>
 </service>
 

Summary

Nested Classes
interface Tunnel.Messages Messenger messages sent between extensions and host applications.
Constants
java.lang.String ACTION_BIND This intent action can be used to find a service that supports the tunnel API.
Protected Constructors
Tunnel()

Constants

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

This intent action can be used to find a service that supports the tunnel API.

Constant Value: "com.sonyericsson.extras.liveware.aef.tunnel.action.BIND"

Protected Constructors

protected Tunnel()