Android Activity Recognition on Wearables

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 08:15:48

You ask

Is the current API already making use of a connected wearable device? (e.g. 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?

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'

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.

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. Spending a lot of time "rolling your own" might be a risk...

Unfortunately, the activity recognition API is not yet implemented on Wear devices. 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!