Galaxy Watch3: Send data to android app through bluetooth(RFCOMM) Fail

Hi, I want to send acquired sensor data to android app(cellphone act as Server) through bluetooth. The watch was paired with my cellphone already. So, I want to send data from watch to my paired cellphone. However, there is only a few infomation I could find from Tizen Document.Bluetooth API

Thus, I want to ask that if there’s any extra data or demo I can learn from? Especially RFCOMM service, because I wrote RFCOMM in my android app. And I tried but the android app can not receive any data.

Thanks!!! :upside_down_face:

And, here’s my code:

    var adapter = tizen.bluetooth.getDefaultAdapter();
	var deviceAddress = "40:B8:37:94:1C:B9";//Xperia Z5 Premium
	var SERVICE_UUID = "00001105-0000-1000-8000-00805F9B34FB";//00001101-0000-1000-8000-00805F9B34FB:ALVIN//00001105-0000-1000-8000-00805F9B34FB
	var clientSocket = null;
	var msg = "hello day";
	if (adapter.powered){
		console.log("Bluetooth is already enabled");
		adapter.getDevice(deviceAddress, onDeviceReady, function(e){
			console.log("Error: " + e.message);
		console.log("Try to launch the Bluetooth Settings application");
		tizen.application.launchAppControl(bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply);

    function onDeviceReady(device){//cellphone
		// Validates device and service uuid
	    if (device.uuids.indexOf(SERVICE_UUID) != -1){
	    	adapter.registerRFCOMMServiceByUUID(SERVICE_UUID, 'My Service', ServiceSuccessCb,
	    			function(e) {
	    		                   console.log( "Could not register service record, Error: " + e.message);
	      console.log("Chat service is not supported by this device");
	    function ServiceSuccessCb(){
	    	device.connectToServiceByUUID(SERVICE_UUID, function(sock) {
	    	    console.log('socket connected');
	    	    clientSocket = sock;
	    	    var somemsg = [3, 2, 1];
	    	    	console.log("sendMessage Success");
	    	}, function(error){
	    	    console.log('Error while connecting: ' + error.message);

For exchanging data between phone and watches, Samsung offers Accessory SDK which allows you to connect accessory devices to Samsung smart devices and transfer information between them.

The Accessory SDK provides a single protocol that supports multiple connectivity technologies, such as Wi-Fi, Bluetooth classic, and BLE (Bluetooth v4.0). The Samsung Accessory Service Framework supports service discovery that is independent of the connectivity technology, and establishes connections between applications for data exchange.

You can check out the programming guide for implementation details:

Sample app in the following link might also be helpful:

1 Like

As @UmmeyHB said is better to use Samsung Accessory Protocol (SAP). It works much better than BT SPP (faster and simple to use).

However, if you can’t use SAP on your Android device you should implement bt server on android side and listen to devices with the same UUID value. Please look for free Android libs with implementation Bluetooth SPP (Serial Port Profile) Server. There is a few projects on github. You must launch a bt server on Android side and listen for incoming connections. It is good idea to pair both bt devices before any transmission.

Bluetooth SPP definitely works on Tizen watches since 2.3.1 but is not so easy to use as SAP is. And don’t try to send more than 1024 bytes at once by socket.

1 Like

Hi, I did implement bt server on android side(app) and listen to devices(watch) with the same UUID value. And tried to use RFCOMM method on both side, but it failed.

On watch side, I wrote:

device.connectToServiceByUUID( SERVICE_UUID, function(socket), function(e) )

And it works successfully, so I think the watch can connect to phone. But when I use socket to wrireData(), android app doesn’t receive any data.

On android app side, I created BluetoothServerSocket to listen for data:

serverSocket = mBluetoothAdapter.listenUsingRfcommWithServiceRecord(NAME, MY_UUID);

So, I wonder if I should exchange server and client roles? Like watch act as a server to send response to android app. And my phone act as a client to request the acquired sensor data.

Thanks for you valuable answer!!! :upside_down_face:

You can’t switch roles server/client on a watch. There is no api for server role on the watch.

Use this trick: turn off BT on watch’ settings and turn on again in a second. After that your Android bt server should see your watch.

1 Like

I first tried to use Samsung Accessory SDK between the watch and phone. Download the sample code you provided ([Accessory SDK version 2.6.4]).

File path is: \AccessorySDK_v2.6.4\Samples\Samples(Web)\Basic(App)\Consumer(Android)_Provider(Tizen)\Consumer\app_SAAgentV2

When I ran Consumer App on Android studio, it showed error like:

A problem occurred configuring project ':app_SAAgent'.
> Failed to notify project evaluation listener.
   > org.gradle.api.file.ProjectLayout.directoryProperty(Lorg/gradle/api/provider/Provider;)Lorg/gradle/api/file/DirectoryProperty;

Can I ask that what’s the problem?

I tried to change Project Structure -> Dependancies -> Requested Version to 28 and download Android SDK->SDK platform->API level:28 , but it doesn’t work!!!
And why there is no gradle-wrapper file in sample?

Sorry for bothering, hope you can help :upside_down_face:

Hello @Egg,
I have faced the same problem while syncing the project. I have resolved the error by changing the Android Gradle Plugin Version from 3.3.2 to 4.0.1. Go to File > Project Structure > Project > Android Gradle Plugin Version. Then change the version to 4.0.1. You can also change the version from build.gradle file.

Hope this will help you. Please share your status.


1 Like

Hi @UmmeyHB,
I succeed ! ! ! !
Thank you so so much~~~ :upside_down_face:


1 Like