DISTRIBUTION OF TIZEN-BASED WATCH APPS HAS BEEN DISCONTINUED

Use the Samsung Accessory Protocol (SAP) API

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

  1. 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.

```xml
<resources>
	<application name="MyApplication">
		<serviceProfile id="/org/example/myapp/my_message" name="MyMessage"
		                role="consumer"  version="1.0">
			<supportedTransports>
				<transport type="TRANSPORT_BT"/>
				<transport type="TRANSPORT_WIFI"/>
			</supportedTransports>
			<serviceChannel id="110" dataRate="low" priority="low"
			                reliability="enable">
			</serviceChannel>
		</serviceProfile>
	</application>
</resources>
```

B. Add meta data to define the Accessory Service Profile XML file location.

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 meta data to define the Accessory Service Profile XML file location](/sd2_images/gear/content/web_application_use_sap01.jpg)
  1. 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.

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

    Add the privilege and click OK.