Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #20 from boswelja/define-accessoryserviceprofile
Browse files Browse the repository at this point in the history
Add back our own accessory services profile
  • Loading branch information
boswelja authored Apr 26, 2021
2 parents 8bcc7d3 + 7f7286d commit ae549e9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 24 deletions.
27 changes: 3 additions & 24 deletions tizen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Provides an interface for connecting to Tizen smartwatches via Samsung's Accessory SDK.

### This platform is currently EXPERIMENTAL and may be prone to crashes and other errors

## Usage

Under the hood, this plugin still uses Samsung's Accessory SDK, so you'll need to be familiar with that first. Find out more here: https://developer.samsung.com/galaxy-accessory/overview.html
Expand All @@ -11,30 +13,7 @@ To use this plugin, you'll want to create an instance of `TizenPlatform`. The re
val tizenPlatform = TizenPlatform(context)
```

At this stage, you still need to create your own Accessory Service Provider xml file.
Make sure to declare 'message' as a supported feature, and point `serviceImpl` to `TizenAccessoryAgent`. You should have something like the this:
```xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<application name="@string/app_name">
<serviceProfile
serviceImpl="com.boswelja.watchconnection.tizen.TizenAccessoryAgent"
role="provider"
name="WatchConnectionLib"
id="/watchconnection/tizen"
version="1.0"
serviceLimit="any"
serviceTimeout="10">
<supportedTransports>
<transport type="TRANSPORT_BT"/>
</supportedTransports>
<supportedFeatures>
<feature type="message"/>
</supportedFeatures>
</serviceProfile>
</application>
</resources>
```
The Accessory application name defaults to `@string/app_name`, however you can override it by setting `@string/accessory_app_name` string yourself.

Find out more via [Samsung's programming guide](https://developer.samsung.com/galaxy-accessory/programming-guide.html).

Expand Down
4 changes: 4 additions & 0 deletions tizen/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<queries> <package android:name="com.samsung.accessory"/> </queries>

<application>
<meta-data
android:name="AccessoryServicesLocation"
android:value="/res/xml/accessory_services_profile.xml" />

<receiver
android:exported="true"
android:name="com.samsung.android.sdk.accessory.RegisterUponInstallReceiver">
Expand Down
5 changes: 5 additions & 0 deletions tizen/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" />
<string name="accessory_app_name">@string/app_name</string>
</resources>
22 changes: 22 additions & 0 deletions tizen/src/main/res/xml/accessory_services_profile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<application name="@string/accessory_app_name">
<serviceProfile
serviceImpl="com.boswelja.watchconnection.tizen.TizenAccessoryAgent"
role="provider"
name="WatchConnectionLib"
id="/watchconnection/tizen"
version="1.0"
serviceLimit="any"
serviceTimeout="10">
<supportedTransports>
<transport type="TRANSPORT_BT" />
<transport type="TRANSPORT_BLE" />
<transport type="TRANSPORT_WIFI" />
</supportedTransports>
<supportedFeatures>
<feature type="message" />
</supportedFeatures>
</serviceProfile>
</application>
</resources>

0 comments on commit ae549e9

Please sign in to comment.