如何使用 android wear DataApi 发送相同的数据两次?

how to send the same data twice using android wear DataApi?

例如,如果我们有媒体播放器,我们想按两次下一步按钮,每次都使用 DataApi 将此操作发送到移动设备。

问题是 DataApi 使用 onDataChange 仅当数据发生变化时才会发送数据。

是否有任何其他选项可以使我的示例正常工作。

For example if we have media player and we want to press next button twice and send this action every time to mobile using DataApi.

Problem is that DataApi uses onDataChange which will send data only when Data has changed

这是预期的行为,这样做是为了节省资源。如果您想强制执行此行为,您可以将 System.currentTimeMillis() 的结果添加到有效负载(例如,添加到 DataMap)以欺骗系统并再次发送有效负载。

编辑:

要发送消息,您应该使用 MessageApi