Webapis is not defined

Hi everyone,

I am working on companion web API app. I can send data from phone to watch perfectly on wearable 3.0. But when I try the same code on wearable 4.0 or 5.0, this error appears:

app.js:175 Uncaught ReferenceError: webapis is not defined

The error referred to this line:

webapis.sa.requestSAAgent(requestOnSuccess, requestOnError);

Note that the same code is working on tizen 3.0. My code is the same as Samsung sample companian code, I didn’t change anything.

Here is my config.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<tizen:application id="UM2FcDkLYZ.HelloAccessoryProvider" package="UM2FcDkLYZ" required_version="2.2"/>
<content src="index.html"/>
<feature name="http://developer.samsung.com/tizen/feature/network.accessory_protocol"/>
<icon src="icon.png"/>
<tizen:metadata key="AccessoryServicesLocation" value="res/xml/accessoryservices.xml"/>
<tizen:privilege name="http://tizen.org/privilege/application.launch"/>
<tizen:privilege name="http://tizen.org/privilege/power"/>
<tizen:privilege name="http://developer.samsung.com/privilege/accessoryprotocol"/>
<tizen:privilege name="http://tizen.org/privilege/healthinfo"/>
<tizen:privilege name="http://tizen.org/privilege/location"/>
<tizen:profile name="wearable"/>
<tizen:setting background-support="enable" encryption="disable" hwkey-event="enable"/>

Thanks in advance.

I am using emulators. Not real devices.

Probably this API is missing on emulator 4.0/5.0. Make sure you have installed all for emualtors.

Don’t worry. For sure it will work on real device 4.0+. Make your tests on emu with sdk 3.0 and finally test on RTL device before you upload your app to Samsung office. Using Samsung Remote Test Lab you can reserve in the same time both phone and watch, pair both and test data transfer by SAP API.

RTL link: https://developer.samsung.com/remote-test-lab

1 Like

Thank you very much for introducing remote-test-lab, it’s very useful to me. I will try it soon.

Regarding the emulator 4.0, 5.0, I have no idea to install the webapis library into the emulators. I installed everything I see in the package manager. Btw if it works on real device then there will be no problem.

I am surprised when I see so many problems with emulators 4.0, 5.0, 5.5 but no one else complain or report issues. Perhaps, people prefer testing on real device than emulators?

Thank you again @andrzej_bugajny!

Yes, it definitely works on real devices. SAP is very important API.

Maybe there are some issues with last Tizen SDK. For sure Tizen developers team will fix it. Please check for new Tizen updates. Maybe it was already fixed.

In case someone else with that problem googled and came here:
There is an issue with the extension files for wearable and the current 4.0 emulator image (as per June 2020). webapis is not installed correctly. If you download the wearable extension files, and try to start the emulator, then it is not correctly installed in the emulator image due to a package conflict. Maybe it gets fixed at some point, until then, make sure to download the Samsung wearable extension from package manager. You might get that error message popup. Then you need to delete 3 files in that folder. Also see the GitHub issue for the workaround: https://github.com/Samsung/Tizen.NET/issues/54#issuecomment-640270363

(The needed webapi-plugin-sec is one package of the extensions. When not correct installed on the 4.0 emulator image, it causes the error described above)

Since I had the exact same issue recently and found this thread via google, I decided to update the workaround here in this (old but still current) thread.
Cheers mate