[英]What is the fastest way to transfer data from watch to phone Android wear
I am trying to move a slider on a phone to reflect to a slider on the watch. 我正在尝试移动手机上的滑块以反映到手表上的滑块。 It is working but the problem is that if I move the slider up and down fast there is a long delay so that my changes take a second or so for the reflection to catch up. 它可以正常工作,但问题是,如果我快速上下移动滑块,则会有很长的延迟,因此我的更改需要一秒钟左右的时间才能反映出来。 I'm using a PutDataMapRequest to communicate through GoogleApiClient. 我正在使用PutDataMapRequest通过GoogleApiClient进行通信。 I guess my real question is there a way to do this faster. 我想我的真正问题是有一种方法可以更快地做到这一点。 I'm just wanting to send an int and a String. 我只是想发送一个整数和一个字符串。
Are you using DataApi? 您正在使用DataApi吗? If so, use MessageApi and send a message via sendMessage(); 如果是这样,请使用MessageApi并通过sendMessage()发送一条消息。 that would be faster. 那会更快。 In addition, you may want to optimize how much data you want to set; 另外,您可能需要优化要设置的数据量; for example, it may be enough to send the "progress" when the seekbar is stopped and not changing any more; 例如,当搜索栏停止并且不再更改时,发送“进度”就足够了; that means no data needs to be sent while it is moving. 这意味着在移动时无需发送任何数据。 If that is too little, you may decide to do a bit of rate control before sending data; 如果太少,您可以决定在发送数据之前先进行一些速率控制。 for example if your seekbar can change between 0 to 100, you most likely don't need to send a message with every change, you can say, for example, send a message when seekbar changes by 3 units and when the seekbar stops changing, send the final value to remain accurate at the end of the process. 例如,如果您的搜索栏可以在0到100之间变化,那么您很有可能不需要每次更改都发送一条消息,例如您可以说,当搜索栏每变化3个单位并且搜索栏停止变化时发送一条消息,发送最终值以在过程结束时保持准确。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.