语言

Menu
Sites
Language
SAP connection failed.

I want to SAP connection to android on the web widget.

I have seen sample in the site and have implemented as below.

 

var peerAgentFindCallback =

    {
       onpeeragentfound: function(peerAgent)
       {
          try
          {
             if (peerAgent.appName == providerAppName)
             {
                SAAgent.setServiceConnectionListener(agentCallback);
                SAAgent.requestServiceConnection(peerAgent);
             }
          }
          catch(err)
          {
              console.log("### peerAgentFindCallback , exception , [" + err.name + "][" + err.message + "]");
          }
       },
       onerror : onerror
    };

 

But, I have seen error meesage as below.

console.log: ### peerAgentFindCallback , exception , [ReferenceError][providerAppName is not defined]

I want to know why this error occur.

 

 

 

响应

2 回复
Iqbal Hossain

Hi~

In your JS file you may be missed this 

var providerAppName = "WeatherProvider";

If you have already added that, now check in config.xml. Make sure you have added these. 

<feature name="http://developer.samsung.com/tizen/feature/network.accessory_protocol"/>
<tizen:metadata key="AccessoryServicesLocation" value="res/xml/accessoryservices.xml"/>
<tizen:privilege name="http://developer.samsung.com/privilege/accessoryprotocol"/>

If you still failed, goto src/main/res/xml=> accessoryservices.xml and check if you have given different name

<resources>
    <application name="WeatherProvider" >
        .....
        .....
        .....
    </application>

</resources>

Application name in this xml file and your providerAppName of JS must be same.

Let me know if it helps you. 

Thanks

 

Iqbal Hossain

Note: This accessoryservices.xml  is from your Android App.