Android wear stream accelerometer data to handheld - android

I an new to android wear app development. I wanted to create an app which streams accelerometer data continuously from wear device to handheld, and do some processing on my handheld. Does anyone know how can I do it?

I went through that pain recently. Try this link (a lot of base code required)
https://developer.android.com/training/wearables/data-layer/index.html up to the syncing data items page
Essentially, the data-api makes a shared dictionary that fires an event when a field is updated. Unfortunately the bluetooth connectivity seems quite slow. My current workaround is to increase the sensor delay and only update if the change is fairly dramatic.

Related

How to get sleep data DIRECTLY from Wear OS?

I am new to Wear OS development, and am trying to get user's sleep duration.
I've managed to get sleep data from other smartbands using raw BLE stack, but I don't know how should I gather sleep data from Wear OS?.
I've searched a bit in the web, and most people suggest to use Google Fit API, but in my case, I can't depend on external APIs.
So these are my questions
1) Is there anyway I can get sleep data from the Wear OS direclty ? If Yes, How?
If No,
2) Should I build a sleep tracker myself (by analyzing watch's movement and heart rate) ?
1) No. WearOS is just a system that provides a runtime environment, maybe along with some base functions. Sleep data is not a basic function, while the raw sensor data is yes.
2) Yes. If you don't want to rely on GoogleFit or other 3rd part API. The only way is to fetch the raw sensor data and analyze them your self.

Possible to automatically sync SQLite from Wearable to Mobile?

I am experienced with using the WearableDataAPI to synchronize both settings and other game information between Watch and Wearable. In fact, currently certain information gets persisted in the DataAPI which works great until you need to reset the watch or mobile.
I would like to convert to using SQLite to store the data on the Mobile. Is there a way of inserting into a Wearable SQLlite database and it automatically replicating to the Mobile? Or would I need to code the data transmission myself using the DataAPI?
As I know there is now such implementations for common databases.
In my practise, DataAPI might lag while syncing huge (>100kB) files, it consumes battery too.
Use MessageAPI in order to improve the performance for message transfer and create two separate databases on both handheld and wearable using common API.
Or, much better, use only one handheld API and tranfer data from handheld into wearable device using MessageAPI each time when you want to render something on your watches.

Making android app with MIT App Inventor that shows data from arduino

I have connected my Arduino and Android phone with a Bluetooth module to display temperature that comes from Arduino with LM35 sensor on the Android.
The Android device can receive the data but it is showing several data at a certain time. So how can I program the Android app with MIT App Inventor so that it will show only one piece of data at a time and replace it when new data comes up?
Here is the App Inventor code and result:
Code
Result
The best I can think of is making it so when ever your android receives data, It'll delete whatever data it's displaying currently, then display the new data. You also may need to increase the time interval on your timer.

HM10/11 BLE to Android Phone connectivity

First off I would like to ask if it is possibe to send a stream of data from an arduino with HM11 to an android phone via bluetooth.
The data contains ultrasonic sensor's readings, orientation, battery level, etc.
My android phone will be displaying those data accordingly acting as a monitor.
I tried coding already using the android studio using the bluetooth guide resources but i end up unable to connect to my module with a message "read failed, closed or timeout -1". I have tried connecting while paired or unpaired. My app can discover HM11 as well as receive the data using HMBLE Terminal app i have downloaded from Play Store. So I guess the android studio guides are not meant from android to bluetooth modules.
I would also like to begin from scratch as i may have missed out some very important basic information.
Any help?

How to recover bluetooth packet loss?? Android

I'm currently creating an Android App where it collects data through bluetooth and draw a real time graph but it seems like after short while there is packet loss and graph comes out weird. I've been searching for a while how to recover the loss but seems like there is no way.... only TCP/IP or UDP has.... Since I need all the data, I can't ignore the packets that doesn't have starting bit or end bit. Is there anyway to prevent the loss or recover the loss completely?
Thanks
Use of RFComm on Android already has built in packet order and reliability like TCP. You should try running tests to see if the Android device is too far away, receiving accurate information, has a bad Bluetooth module, or if the sensor is at fault.

Categories

Resources