GeoTecINIT / WearOSSensors

Reliable and concurrent access to smartwatch's sensors
Apache License 2.0
18 stars 4 forks source link

Starting/Stopping Data Collection from Smartphone #10

Open Mustafa-raja opened 2 months ago

Mustafa-raja commented 2 months ago

The library documentation states:

Start/stop data collection from smartphone

The library fully handles this for you. You can start and stop the data collection from the smartphone and receive the collected data. You have to do nothing!

While this suggests that the library supports starting and stopping data collection from the smartphone, it does not provide any details or examples on how to trigger these actions.

Request:

Could you please provide additional documentation or examples on how to:

Detailed instructions or code snippets demonstrating these functionalities would be greatly appreciated.

Additional Context:

This information is crucial for integrating the library into applications where control of data collection needs to be managed from a smartphone rather than the Wear OS device.

Thank you for your assistance!

matey97 commented 2 months ago

Hi @Mustafa-raja, as stated in the second paragraph of the README:

This library can be used to build WearOS applications that are the counterpart of smartphone applications built with the nativescript-wearos-sensors plugin (for the NativeScript framework). The smartphone application counterpart can request to start/stop the data collection on the smartwatch, and then receive the collected data from the smartwatch.

Basically, starting/stopping the data collection from the smartphone is possible when the smartphone application uses the nativescript-wearos-sensors NativeScript plugin. The main drawback is that the smartphone application has to be developed using NativeScript (a multiplatform development framework) and not native technologies (why? to integrate this feature into another set of features that we already developed in NativeScript).

Therefore, to use this library and control the data collection from the smartphone, there are two options:

  1. Develop a NativeScript app and use the nativescript-wearos-sensors plugin. There is a demo application in the plugin's repository that you can check, and the last release contains an apk you can install and test.
  2. Implement in the smartphone the required components to handle the communication (start/stop, receive data, etc.) with the smartwatch. Basically, the smartwatch and the smartphone communicate using the Android's Message Client using a defined protocol. So the smartphone needs to implement its communication protocol part. For example, to start the data collection of the ACCELEROMETER, the smartphone sends a message with the desired collection interval and return batch (interval#batchSize) to the path /accelerometer/start. It would be like translating the nativescript-wearos-sensors code (TypeScript) into Java/Kotlin. I would not recommend it, but if you need a native application this is the only way.

Let me know if you need more information or further assistance.

Mustafa-raja commented 2 months ago

Thank you for the reply, I used Google's data layer API to establish communication. It would be good to have the communication feature added for Android using java/kotlin

matey97 commented 2 months ago

I know it would be nice to have a smartphone native library. However, right now I'm busy with other things and can't commit to develop it. I might do it in the future, but can't promise anything or give an ETA. Sorry 😞.

Mustafa-raja commented 2 months ago

would you mind if i fork your code and build those features on it ?

matey97 commented 2 months ago

Of course you can! But bear in mind that you will have to build those features in a specific library for the smartphone. I mean, WearOSSensors is meant for smartwatches, thus you should create another library/app for smartphones.