Languages

Menu
Sites
Language
Samsung Accessory Protocol: Samsung Galaxy S4 and Samsung Gear S2 Connect Network Failure

Hello,

Trying to connect a consumer app (Android) and provider app (tizen) with Samsung Accessory Protocol.

When I load android app from Android Studio, it works well, but when if I turn off Samsung Galaxy S4, and I turn on, 

I receive a error 1280 (CONNECTION FAILURE NETWORK)

08-11 01:20:06.293 7993-8064/com.worldline.smartretail I/SASocket: Connection request enqued successfully for peer:39905
08-11 01:20:06.353 7993-8064/com.worldline.smartretail W/SASocket: connectionId is null so cleaning up
08-11 01:20:06.353 7993-8064/com.worldline.smartretail E/SAAgent: Connection attempt failed wih peer:39905 reason:1280
 
My Android Manifest.xml:
<receiver android:name="com.samsung.android.sdk.accessory.RegisterUponInstallReceiver">
    <intent-filter>
        <action android:name="com.samsung.accessory.action.REGISTER_AGENT" />
    </intent-filter>
</receiver>
<receiver android:name="com.samsung.android.sdk.accessory.ServiceConnectionIndicationBroadcastReceiver">
    <intent-filter>
        <action android:name="com.samsung.accessory.action.SERVICE_CONNECTION_REQUESTED" />
    </intent-filter>
</receiver>

My method for receive ServiceConnectionResponse:

@Override
protected void onServiceConnectionResponse(SAPeerAgent peerAgent, SASocket socket, int result) {
    if (result == SAAgent.CONNECTION_SUCCESS) {
        this.mConnectionHandler = (ServiceConnection) socket;
        smartwatchPresenter.onServiceConnectionEstablished();
        updateTextView("Connected");
    } else if (result == SAAgent.CONNECTION_ALREADY_EXIST) {
        updateTextView("Connected");
        Toast.makeText(getBaseContext(), "CONNECTION_ALREADY_EXIST", Toast.LENGTH_LONG).show();
    } else if (result == SAAgent.CONNECTION_DUPLICATE_REQUEST) {
        Toast.makeText(getBaseContext(), "CONNECTION_DUPLICATE_REQUEST", Toast.LENGTH_LONG).show();
    } else {
        Toast.makeText(getBaseContext(), "Service Connection Failure " + String.valueOf(result), Toast.LENGTH_LONG).show();
    }
}

Why connection works only when app is loaded from Android Studio? Only thing I see is that when Ioad app from Android Studio, I'm reinstalling the APK.

I'm using protocol TRANSPORT_BT.

Thank you,

Joaquim Puyo

Responses

4 Replies
Iqbal Hossain

Hi, 
Can you please tell me your Android version ? 

And have you installed Samsung Accessory Service in your android device? 

Accessory SDK has the following restrictions:

  • Accessory SDK only supports the GALAXY Gear (from January 2014 version), Samsung Gear 2, Samsung Gear 2 Neo, Samsung Gear S, and Samsung Gear S2.
  • Both the smart and accessory device must have the Samsung Accessory Service Framework installed.
  • Devices with Android 4.3 or higher support Accessory SDK (since they are equipped with the Samsung Accessory Service Framework).

Ref:

http://developer.samsung.com/galaxy#accessory

https://play.google.com/store/apps/details?id=com.samsung.accessory&hl=en

Joaquim Puyo Garrido

Hello,

Android version is 4.4.2. I think Samsung Accesory Service is installed, because smartphone and smartwatch work good when I install the application, but not when I turn on the smartphone.

It is supposed that Samsung Galaxy has Samsung Accesory Service Framework installed, no? I'm going to check it.

Thank you,

Joaquim

Iqbal Hossain

Ok. Please check.
Thank You. 

Joaquim Puyo Garrido

Samsung Accessory Service Framework is installed. I don't understand why app connects successfully after installing application, and when I turn on the smartphone, app does not connect.

Why connectionId is null???

08-11 01:20:06.293 7993-8064/com.worldline.smartretail I/SASocket: Connection request enqued successfully for peer:39905
08-11 01:20:06.353 7993-8064/com.worldline.smartretail W/SASocket: connectionId is null so cleaning up
 
If you have another idea, tell me
 
Thank you,
Joaquim