Host android application to initiate communicate with tizen application(Android to tizen)

406 Views Asked by At

I have an android application which needs to make a connection when need with gear 2 device. It just need to ask a question(yes or no) on tizen and get response back How do I do this ?? There are many tutorials (helloaccessoryprotocol app) which initiates the connection from tizen but what i need is other way round

findPeerAgents() call gives the below log 

onFindPeerAgentResponse arg0 =sapimageswitcher arg1 =0
In try block of find peer agent response
SAP CONNECTION CONSTRUCTOR
onServiceConnectionResponse result error =1030

The error code here means CONNECTION_FAILURE_PEERAGENT_NO_RESPONSE

on the tizen side for agentCallback i included onrequest function as below

var agentCallback = {
onrequest : function(peerAgent) {
    console.log(" onrequest " + peerAgent);
    SAAgent.acceptServiceConnectionRequest(peerAgent);
},
onconnect : function(socket) {
    console.log( "agentCallback onconnect" + socket);
    SASocket = socket;
    alert("SAP Connection established with RemotePeer");
    createHTML("startConnection");
    SASocket.setSocketStatusListener(function(reason){
        console.log("Service connection lost, Reason : [" + reason + "]");
        disconnect();
    });
},
onerror : onerror 
};

Please tell me if I am missing anything else, Thank you.

1

There are 1 best solutions below

0
On

Have you tried reversing the roles of Consumer and Provider. I guess that should fix it. Also check your config XML files if the roles, channels are all set properly.