问题描述
我正在研究如何使用android智能手表进行活动识别的方法。目前,我专注于检测用户是走路还是站着。我的第一个想法是使用内置的计步器,但是后来我遇到了Android Activity Recognition API(我对Android ^^比较陌生),该API似乎仅在移动应用中使用。
I'm researching ways on how to do activity recognition using an android smartwatch. Currently, I'm focusing on detecting whether the user is walking or standing still. My first idea was to use the built in step counter, but then I came across the Android Activity Recognition API (I'm relatively new to Android^^) which seems to be used in mobile apps only.
我现在坚持回答以下问题:
I'm now stucking at answering the following questions:
- 当前的API是否已经在使用已连接可穿戴设备?
(例如,自动访问内置的可穿戴式传感器) - 是否有可用于Android Wear的单独API?
- 是否还有其他功能如何使用可穿戴设备进行活动识别的最佳实践? (尤其是走路和站着不动)
在研究期间,我已经尝试过以下操作:
During my research I've already tried the following things:
- 阅读《 Android活动识别指南》
- 阅读关于Google的活动识别API
- 实现简单使用当前活动识别API的Android Wear应用。我在LG G Watch上测试了该应用程序,但没有成功。看来我可以连接到ActivityRecognitionClient,但是我从未收到任何活动更新。我在Nexus 5上尝试了相同的代码-一切正常。
- 通读。在这里,作者就像 ...我们喜欢 Android Wear 的活动识别API,因为我们一直认为位置跟踪技术是此类功能的重要支柱...。因此,据此,有一个单独的API,对吧?
- Reading through the Android Activity Recognition Guide
- Reading through this article about Google's Activity Recognition API
- Implementing a simple Android Wear App which uses the current Activity Recognition API. I tested the app on my LG G Watch without success. It seems like I can connect to the ActivityRecognitionClient but I never receive any activity updates. I tried the same code on my Nexus 5 - everything works fine.
- Reading through this post about Google Play Services. Here the author is like "...We like the Activity Recognition API for Android Wear, as we’ve always thought the location tracking technology was a great backbone for this type of functionality...". So according to this, there is a seperate API, right?
我非常感谢你们提供的任何有用信息。我认为,一件很酷的事情(请参阅第一个问题)是当手机不确定当前用户的活动时,自动检测连接的可穿戴设备并使用其传感器来提高准确性。
I would be very thankful for any helpful information from you guys. In my opinion, a cool thing (see first question) would be to automatically detect a connected wearable device and use its sensors for enhancing the accurancy when the mobile phone is unsure about the current user's activity.
推荐答案
您问
不,这没有道理吗?可穿戴和手持设备并非总是同时携带;手表可以移动,而手持设备可以静止。 (反之亦然)我不确定合并测量的值是多少。
No, and this would not make sense would it? The wearable and handheld device is not always carried at the same time; the watch can be moving, and the handheld still. (vice versa) I am not sure what the value of a combined measurement would be.
是。 google提供了不同的Google Play服务库或可穿戴设备,您会在编译依赖项中看到它;
Yes. google provide a different Google Play Services library or wearables you see this in the compile dependencies;
compile'com.google.android.gms:play-services-wearable:6.5.87'
vs
compile 'com.google.android.gms:play-services:6.5.87'
因此,当您在第一个Moto360应用中测试API时,实际上是导入了面向手持设备的播放服务库,而不是可穿戴版本。客户端API的可穿戴版本中不包含常量 ActivityRecognition.API。
So, when you tested the API in your first Moto360 app, you actually imported the play services libraries meant for handhelds instead of the wearable version. The constant "ActivityRecognition.API" is not included in the wearable version of the client API.
一种方法是使用原始加速度计数据检测运动。很容易检测到设备根本没有移动,而检测其他任何事情也不是一件容易的事。
One way would be to use the raw accelerometer data to detect motion. It is fairly easy to detect that the device is not moving at all, to detect anything else is not trivial.
如果愿意,您可以将传感器数据从可穿戴设备推送到手持设备进行处理。如果您想显示一些代码来告诉我,请给我打电话。我不想发布它,因为它与问题无关。
You could push sensor data from the wearable to the handheld for processing there if you like. Ping me if you'd like some code showing just that. I don't want to post it since it is not relevant to the question.
我的猜测是Google将来会在手持设备中包含此API。花很多时间自己动手可能会有风险...
My guess is that Google will include this API on the handheld device in the future. Spending a lot of time "rolling your own" might be a risk...
这篇关于可穿戴设备的Android活动识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!