2

As part of adding support for Android 'Marshmallow' 6.0 to an Android app, we're updating various dependencies. One of these is a library in the form of Samsung's Accessory SDK. Current version of the library is 2.2.2, whereas the latest one is 2.3.0 (which is the direct successor of 2.2.2).

Version 2.3.0 has a note indicating that this is definitely the one we want:

Samsung Accessory SDK 2.3.0 (and above) is required for devices on Android 6.0(Marshmallow).

So... time to update! The dependency update appears to be painless, as no compile errors occur and the version bump was only a minor one (I know of course I can't rely on that, but generally this does provide a 'signal'). Also, the release notes do not explicitly highlight any breaking changes, which you would expect to be clearly pointed out if there were any.

But... after the update, the Android 'companion' app and Tizen wearable app (running on a Gear S2 watch) no longer appear to be able to establish a connection and communicate with each other. Reverting to Accessory SDK version 2.2.2 magically makes everything work again.

So, something definitely changed. In fact, there appears to be a breaking change that is not clearly documented anywhere.

My question: what is this change (or changes) and how to correctly upgrade from Samsung Accessory SDK 2.2.2 to 2.3.0?

MH.
  • 45,303
  • 10
  • 103
  • 116

1 Answers1

2

So, after a whole lot more of reading and looking into various corners of Samsung's documentation and fora, I managed to find the breaking change and solution on how to correctly upgrade from Accessory SDK 2.2.2 to 2.3.0.

First of all, there are two release note sections for Accessory SDK 2.3.0: one with Oct 29, 2015 as release date, and one for Sep 3, 2015. I compared the actual jars that make up the SDK, and they appear to be identical, leaving me to guess that it's probably only documentation and/or examples that got updated. Still... two 'releases' with the same versioning... C'mon Samsung!

Anyways, the second set of release notes mentions this:

New intent actions will be required when you initialize Accessory and Accessory File Transfer. Refer to the programming guide for more information.

Going through this 'Programming Guide - which, by the way, seems to have been updated somewhere inbetween the two 2.3.0 releases - I noticed the following note in section 3.3.1 (page 19):

Note. Name of actions are changed from 2.3.0. For backward compatibility, old actions will be supported continuously for a while.

Also, it seems to belong to this code snippet:

<receiver android:name="com.samsung.android.sdk.accessory.ServiceConnectionIndicationBroadcastReceiver">
    <intent-filter>
        <action android:name="com.samsung.accessory.action.SERVICE_CONNECTION_REQUESTED"/>
    </intent-filter>
</receiver>
<receiver android:name="com.samsung.android.sdk.accessory.RegisterUponInstallReceiver">
    <intent-filter>
        <action android:name="com.samsung.accessory.action.REGISTER_AGENT"/>
    </intent-filter>
</receiver>

Since it mentions the actions again, I compared them with those in my app's manifest, and sure enough, there's a difference. My actions for these receivers say:

<action android:name="android.accessory.service.action.ACCESSORY_SERVICE_CONNECTION_IND" />

<action android:name="android.accessory.device.action.REGISTER_AFTER_INSTALL" />

After updating the actions to the new com.samsung.** ones, everything started working again!

To conclude: the statement in the release notes claiming that "For backward compatibility, old actions will be supported continuously for a while" is simply not true. The old actions are no longer supported, resulting in a breaking chance when you update from 2.2.2 tot 2.3.0. Updating the actions to the new ones fixes everything.


Update: It appears I wasn't the only one to arrive at this conclusion, looking at this thread on one of Samsung's boards.

MH.
  • 45,303
  • 10
  • 103
  • 116