Samsunge companion app peer agent name change not working

hello, need help. I’m developing a companion watch application through the SAP. it’s working well with the provider name HelloAccessoryProvider as in all the examples I saw. But I need to change that HelloAccessoryProvider name. So I did the changes to these files.

Android App Side: accessoryservices.xml

<application name="GumDataProvider" >
        <serviceProfile
            id="/gum/connect"
            name="gumdataprovider"
            role="provider"
            serviceImpl="com.allapps.gum.TizenService"

Watch App Side: js file

change the provider name to the above application name.

var SAAgent = null;
var SASocket = null;
var CHANNELID = 104;
var ProviderAppName = "GumDataProvider";

but unfortunately when trying to connect the predefined error message occurs, due to the condition

if (peerAgent.appName == ProviderAppName) {
	SAAgent.setServiceConnectionListener(agentCallback);
	SAAgent.requestServiceConnection(peerAgent);
} else {
	createHTML("Not expected app!! : " + peerAgent.appName);
}

not expected app! HelloAccessoryProvider.

So I print the peer agent data.

{
   "peerAccessory":{
      "deviceAddress":"1C:02:19:84:48:68",
      "transportType":"TRANSPORT_BT",
      "vendorId":"undefined",
   },
   "appName":"HelloAccessoryProvider",
   "maxAllowedDataSize":1048576,
   "profileVersion":"1.0",
   "feature":[
      "SOCKET"
   ]
}

still, it shows the app name as HelloAccessoryProvider . I changed it in accessoryservices.xml as GumDataProvider.

Hope your support to solve this issue. Thank you!

Hi,
Have you checked your Android side app properly? Please check if there is any variable that defined the name.

hello, I solved it. anyways, I don’t have a clear idea what happened there. I tried a lot more time to solve this. I tried different ways of changing

res/xml/accessoryservices.xml

file on both the Android and my watch app side. finally, it worked but I don’t know what should be the correct thing have to do. I didn’t do too many name changes in naming parts. I used the original name and add my app name prefix. for example on my Android app side,

<application name="GumAccessoryProvider" >

when I use GumProvider, it didn’t work. but when I use GumAccessoryProvider, it worked. the original text is HelloAccessorryProvider and I just replaced Hello part and it worked.

And as well the id part in the service profile,

id="/gum/watch"

when I use

/gum/app/watch

it didn’t work. so seems it doesn’t get long id’s and I used /gum/watch it worked. the doc says it has a maximum of 30 characters there. (https://developer.samsung.com/galaxy-watch-tizen/creating-your-first-app/web-companion/use-sap.html)

And remember to do the changes in both res/xml/accessorry file changes in Android and your watch side.

I don’t know is this the correct approach. but this worked for me. Thanks!

1 Like

Great to know your problem is resolved.

Cheers!