Samsung Watch 4 Accelerometer Recorder

Hi everyone,

I’m very new in building a wearable app, however, currently am trying to find a way to access the accelerometer in the samsung watch and record the raw acceleration data from it and send it through to the phone.

I’m not sure where to start and how to do it or is it even possible to do.

Any help is much appreciated.

Best Regards.

I moved this to the Watch Face Studio forum as there are some Developers on that forum that may be able to help you.

However, this is a Wear OS powered by Samsung developer Issue and should be in an Android Wear developer discussion or information. You should try asking there.

I saw a code example on Fall Detection but I’m not sure it it was on Git Hub or a code lab. That may be something that will help you get started, it used fast acceleration as a component to detect falls.

Ron
Samsung Developer Relations

Hi Ron,

Thank you very much for your help, I was unsure before whether I posted at the correct place.

I had tried to built it on the Tizen studio, however it seems that I have trouble with connecting my laptop with the watches, I’ve looked around the forum and online, nothing have helped.

I’ve tried:

  • Manually connect the watch with the laptop through wifi by first:

    Turn on the ADB debug mode and debugging over wifi on the watches
    Get the IP address from the connected wifi (and make sure the wifi connected on my laptop with the watches are the same).

  • Create a remote connection then create a new one, with the IP address given from the above + setting the port as the same as the port shown in the wifi, as the IP address are given as: xxx.xxx.x.xxx:yyyy, where x’s are the IP address and y’s are the port number.
  • Get a notification from the watch to allow the debugging mode, and click yes
  • However when I tried to run the code, it fails when it tries to transferring the file packages.

Note that I also have register a certificate as well.

Below is the screenshot of the error.
image

Tizen Studio is for Tizen OS which are Galaxy Watch 3 and older. Watch 4 is Wear OS Powered by Samsung (AKA Wear OS 3) Wear OS API 28 and newer. For development on that you need to use Android Studio.

Ron
Samsung Developer Relations

Hi Ron,

Thank you very much for that.

Hi everyone,

I’m fairly new in building wearable app and have little to no experience in coding, is there any guide on this? I’ve tried to read through the documentation in here but have no luck on understanding it.

Can anyone guide me through how to build this?

Hi llimbri,
You can use SensorManager to get raw data of accelerometer from the Samsung Galaxy Watch4.
Link:

As you are new for beginner guide you can read out the below links also:

  1. Sensors Overview  |  Android Developers
    2.This link will help you to use prerequisites before using sensor manager library: Check Which Sensor You Can Use in Galaxy Watch Running Wear OS Powered by Samsung | Samsung Developers

Thanks,
Shamima.

1 Like

Thank you very much for your help!

I managed to build the app to record the accelerometer, but I found a new problem on writing the file to the storage in the watch. I got the following error:

java.io.FileNotFoundException: /storage/emulated/0/Download/2022.08.11/134127.csv: open failed: ENOENT (No such file or directory)

I imported the opencsv package and tried to write the data recorded to the directory shown above.

I have also allow permission for the app to access the storage in the watch itself, did I missed anything?

Hi,
Check this guide for file storage if you have missed anything:

Make sure your API level is 30 or above.
Please share your status after using this guide.

Thanks.

1 Like

Hi there,

I’ve resolved this issue, I have found is because I’m trying to save the file inside non-existent folder due to a typo, this has now been resolved. Thank you for all the helps cheers.