Use the Samsung Accessory Protocol (SAP) API

To use the SAP API, change some configurations in your application project:

Add the Accessory Service Profile.

Communicating with an Android application requires a declaration of descriptions about the Accessory Service Profile. The profile is declared in a separate XML file in the /res/xml folder of the application project. The actual path of the XML file can be described with ‘meta data’ in the config.xml file.

A. Add the accessoryservices.xml file in the /res/xml folder.

For an example file, see the following sample Accessory Service Profile. You can modify the id value of the serviceProfile element to define your application. The id value must be unique globally and it is also used in the Android side application to identify the service profile.

Note :

The service profile ID must start with ‘/’, followed by [0-9], [a-z], ‘_’, and ‘/’ (as delimiter). The maximum length is 30 characters. For more information about the XML file, see this.

Open the config.xml file in the Web application configuration editor, select the Tizen tab. In the Meta data section, click Add, define the key as AccessoryServicesLocation and the value as /res/xml/accessoryservices.xml, and click OK.

Add the required privilege.

To use the SAP API, the http://developer.samsung.com/tizen/privilege/accessoryprotocol privilege must be added in the config.xml file.

Open the config.xml file in the Web application configuration editor, select the Privileges tab, and click Add.