Accessory SAP communication Tizen and Android PeerAgent_No_Response

Accessory SAP communication Tizen and Android PeerAgent_No_Response

BY 27 Mar 2015 Web Application Development

Currently i am creating a safety application for the samsung smartwatch. I want users to be able to register on their smartphone and send these data to the smartwatch app. I followed the samsung tutorial for Accessory SAP communication. Most things work, i click on connect on the smartwatch and it tries to connect. 

The method i call on tizen is this:

SAAgent.setServiceConnectionListener(agentCallback);

var agentCallback = {
        onconnect: function(socket){
            alert("agentCallback connect" + socket);
            SASocket = socket;
            alert("connected");
            SASocket.setSocketStatusListener(function(reason){
                console.log("Service Connection lost, Reason: ["+ reason+"]");
                disconnect();
            })
        },
        onerror: function(error){
            alert("agentCallBack"+error);
        }
};

When i call SAAgent.setServiceConnectionListener(agentCallback), the android code below here is triggered. But this always returns PEERAGENT_NO_RESPONSE error.

@Override

protected void onServiceConnectionRequested(SAPeerAgent peerAgent){ 
//Toast.makeText(getBaseContext(), "TESTG", Toast.LENGTH_SHORT).show();
 super.acceptServiceConnectionRequest(peerAgent)
}

I was wondering what i am doing wrong.

Written by