0

I have a wear app which acts as a controller to another app in mobile. I have used message api to communicate between the devices. The messages include recognized touch and non-touch gestures and these will be displayed on the mobile app. Everything worked fine until I started sending continuous data.

I wanted to store the sensor data of watch in a file in mobile. So I started sending sensor data at a sampling rate of 200ms along with the recognized gestures. Now I can see a lot of delay in displaying the recognized gesture in the phone since the amount of data being sent is too high. The delay increases as time goes on.

Is it because the message api is too slow? Is there any other alternative way to send messages? Will channel api help? I would like to know few ideas to try out and fix this delay in receiving data.

NewOne
  • 401
  • 5
  • 19

1 Answers1

0

It is recommended in the documentation for Building Apps for Wearable that you can use the ChannelApi class to transfer large data items, such as music and movie files, from a handheld to a wearable device.

Here is the list of benefits of Channel API for data transfer:

  • Transfer large data files between two or more connected devices, without the automatic synchronization provided when using Asset objects attached to DataItem objects. The Channel API saves disk space unlike the DataApi class, which creates a copy of the assets on the local device before synchronizing with connected devices.

  • Reliably send a file that is too large in size to send using the MessageApi class.

  • Transfer streamed data, such as music pulled from a network server or voice data from the microphone.

Note: that these APIs are designed for communication between handhelds and wearables, these are the only APIs you should use to set up communication between these devices. For instance, don't try to open low-level sockets to create a communication channel. And Channels are only available when the wearable nodes are connected. When the remote node disconnects, all existing channels will be closed. Any listeners (added through [addListener(GoogleApiClient,ChannelListener)](https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelApi#addListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.ChannelApi.ChannelListener)) and any installed WearableListenerService) will be notified of the channel closing

For more information, just check this documentation, especially the LESSONS part.

KENdi
  • 7,576
  • 2
  • 16
  • 31