Subscription preference

Notification emails are sent to your Samsung account email address.

* Email : anonymous@samsung.com

  

Close

What to do with ALREADY_EXIST & PEERAGENT_REJECTED?

Forums View
Started by Developer shuisky , 2520 Seed May 06, 2014 05:25 Replies : 3 View : 10271 Likes : 9
Hi,
I begin recive very often those 2 exceptions:
ALREADY_EXIST : The remote Accessory Peer Agent already exists.
PEERAGENT_REJECTED : The remote Accessory Peer Agent rejected the request.
I didn't see solutions in help how to solve them.
Didn't see any methods like UseAlreadyExistedPeerAgent() or DistroyAlreadyExistedPeerAgent() to begin use already existed Peer Agent or kill it and use new my. Also what to do if I receive 'rejected'. Why? What the reason? What to do then?
And helps only reinstall the app.
Post Reply
Board View
Samsung Developer cjbijoy , 37520 Seed May 06, 2014 10:56 Post #1 3
When are you getting this exception? Is there any other info on the log?
Post Reply
Board View
Developer shuisky , 2520 Seed May 06, 2014 11:20 Post #2 3


This content has been quoted from cjbijoy’s thought.

When are you getting this exception? Is there any other info on the log?

Hi, It's in app based on SAP example 'Hello Accessory' from Samsung. On watch side.

Code

var agentCallback = {
  onconnect : function(socket) {
    log("agentCallback.onconnect");
    SASocket = socket;
    SASocket.setSocketStatusListener(function(reason){
      log("Service connection lost, Reason : [" + reason + "]");
      disconnect();
    });
    SASocket.setDataReceiveListener(onreceive);
    send();
  },
  onerror : function(err) {
    log('agentCallback.onerror: '+err);
    onerror(err);
  }
};

var peerAgentFindCallback = {
  onpeeragentfound : function(peerAgent) {
    try {
      log("peerAgentFindCallback.onpeeragentfound: "+peerAgent.appName);
      if (peerAgent.appName == ProviderAppName) {
        log("SAAgent.setServiceConnectionListener");
        SAAgent.setServiceConnectionListener(agentCallback);
        log("SAAgent.requestServiceConnection");
        SAAgent.requestServiceConnection(peerAgent);
        log("SAAgent.requestServiceConnection end");
      } else {
        log("Not expected app ("+ProviderAppName+"): " + peerAgent.appName);
      }
    } catch(err) {
      log("onpeeragentfound exception [" + err.name + "] msg[" + err.message + "] "+err);
      showError(err);
    }
    },
  onerror : function(err) {
    log('peerAgentFindCallback.onerror: '+err);
    onerror(err);
  }
}

and in log file strings like this:

SAAgent.setServiceConnectionListener
SAAgent.requestServiceConnection
SAAgent.requestServiceConnection end
agentCallback.onerror: ALREADY_EXIST


that's all. Just one word - ALREADY_EXIST.

and the same when PEERAGENT_REJECTED
Post Reply
Board View
Samsung Developer cjbijoy , 37520 Seed May 07, 2014 10:13 Post #3 3
When you get PEERAGENT_REJECTED, just check what happens on the host side, are you accepting the connection there or the callback is not getting invoked itself?
Also just have only your app installed in both the devices, because I feel ALREADY_EXISTS may be caused by the existance of hello world sample which you modified to create your app? As you said, proper explanations for the error code are missing.
Post Reply