简体   繁体   English

可穿戴设备上的Android活动识别

[英]Android Activity Recognition on Wearables

I'm researching ways on how to do activity recognition using an android smartwatch. 我正在研究如何使用android智能手表进行活动识别。 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. 我的第一个想法是使用内置的步骤计数器,但后来我遇到了Android Activity Recognition API(我对Android ^^相对较新),它似乎只在移动应用程序中使用。

I'm now stucking at answering the following questions: 我现在正在坚持回答以下问题:

  • Is the current API already making use of a connected wearable device? 当前的API是否已经使用了连接的可穿戴设备? (eg automatically accessing built-in wearable sensors) (例如自动访问内置可穿戴传感器)
  • Is there a seperate API available for Android Wear? 是否有针对Android Wear的单独API?
  • Is there any other best practice on how to use wearables for activity recognition? 关于如何使用可穿戴设备进行活动识别,还有其他最佳实践吗? (especially walking and standing still) (特别是走路和站立不动)

During my research I've already tried the following things: 在我的研究期间,我已经尝试过以下事项:

  • Reading through the Android Activity Recognition Guide 阅读Android活动识别指南
  • Reading through this article about Google's Activity Recognition API 阅读本文关于Google的Activity Recognition API
  • Implementing a simple Android Wear App which uses the current Activity Recognition API. 实现使用当前Activity Recognition API的简单Android Wear应用程序。 I tested the app on my LG G Watch without success. 我在LG G Watch上测试了应用程序但没有成功。 It seems like I can connect to the ActivityRecognitionClient but I never receive any activity updates. 好像我可以连接到ActivityRecognitionClient,但我从未收到任何活动更新。 I tried the same code on my Nexus 5 - everything works fine. 我在Nexus 5上尝试了相同的代码 - 一切正常。
  • Reading through this post about Google Play Services. 阅读这篇关于Google Play服务的帖子 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...". 这里的作者就像“......我们喜欢Android Wear的Activity Recognition API,因为我们一直认为位置跟踪技术是这类功能的一个很好的支柱......”。 So according to this, there is a seperate API, right? 所以根据这个,有一个单独的API,对吗?

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. 在我看来,一个很酷的事情(参见第一个问题)是自动检测连接的可穿戴设备,并在手机不确定当前用户的活动时使用其传感器来提高准确性。

You ask 你问

Is the current API already making use of a connected wearable device? 当前的API是否已经使用了连接的可穿戴设备? (eg automatically accessing built-in wearable sensors) (例如自动访问内置可穿戴传感器)

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. (反之亦然)我不确定组合测量的价值是多少。

Is there a seperate API available for Android Wear? 是否有针对Android Wear的单独API?

Yes. 是。 google provide a different Google Play Services library or wearables you see this in the compile dependencies; 谷歌提供了一个不同的Google Play服务库或可穿戴设备,您可以在编译依赖项中看到这一点;

compile'com.google.android.gms:play-services-wearable:6.5.87'

vs VS

compile 'com.google.android.gms:play-services:6.5.87'

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. 因此,当您在第一个Moto360应用程序中测试API时,您实际上导入了适用于手持设备而不是可穿戴版本的播放服务库。 The constant "ActivityRecognition.API" is not included in the wearable version of the client API. 常量“ActivityRecognition.API”不包含在客户端API的可穿戴版本中。

Is there any other best practice on how to use wearables for activity recognition? 关于如何使用可穿戴设备进行活动识别,还有其他最佳实践吗? (especially walking and standing still) (特别是走路和站立不动)

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. 我不想发布它,因为它与问题无关。

My guess is that Google will include this API on the handheld device in the future. 我的猜测是Google将来会在手持设备上加入此API。 Spending a lot of time "rolling your own" might be a risk... 花很多时间“滚动自己”可能是一种风险......

Unfortunately, the activity recognition API is not yet implemented on Wear devices. 遗憾的是,活动识别API尚未在Wear设备上实现。 When I tested a simple ActivityRecognitionClient API example program on my Motorola Moto 360 (with "4.4W 2"), I got a message indicating that on the logcat stream. 当我在我的Motorola Moto 360上测试一个简单的ActivityRecognitionClient API示例程序(带有“4.4W 2”)时,我收到一条消息,指示在logcat流上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM