12

Is there any generic mechanism to check whether the paired Android Wear is worn (and within range)?

The criteria for worn could be one or more of the following: - Wear within range of Phone (connected). - Has a pulse (if device has that capability). - Wear has moved (if device has a motion sensor).

My goal is only to send notifications to the Android Wear from the phone if it is connected and worn. Otherwise it should only be displayed on the phone.

hirro
  • 671
  • 10
  • 17
  • connected is simple. You could use the NodeApi for that – Blackbelt Apr 24 '15 at 09:05
  • Yes, but connected is implicit by the worn criteria. – hirro Apr 24 '15 at 09:08
  • no it is not. You could have the watch on the table still connected to the phone. It doesn't that much sense, but.. – Blackbelt Apr 24 '15 at 09:08
  • Ok, it is implicit if the worn criteria is true :-). Otherwise I don't want to send the Android Wear notification anyway. – hirro Apr 24 '15 at 09:14
  • no it is not. You could stil wearing the watch but it is disconnected from your phone. Still I don't know how catch the event "The user is wearing the watch" – Blackbelt Apr 24 '15 at 09:17
  • I would like to check the worn criteria on the watch from the phone, maybe I should clarify that! – hirro Apr 24 '15 at 09:29
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/76150/discussion-between-hirro-and-blackbelt). – hirro Apr 24 '15 at 09:31

2 Answers2

1

Motion sensors are your best bet. You can try monitoring changes and if there is none for a certain amount of time, you can treat it as a device not being worn.

However, Google already did that for you: https://developer.android.com/reference/com/google/android/gms/location/DetectedActivity.html ActivityRecognitionApi will give you information about motion of the device, so you don't need to figure these things again yourself.

Most specifically, you are looking for this: https://developer.android.com/reference/com/google/android/gms/location/DetectedActivity.html#STILL

gruszczy
  • 40,948
  • 31
  • 128
  • 181
  • I have looked at the ActivityRecognitionApi and it indeed does what I asked, but only on the handheld. Is it possible to check the activity on the wear from my application on the handheld (without any wear application)? – hirro Apr 28 '15 at 11:21
  • No, you need use the ActivityRecognitionApi on the wearable and sync this information to the handheld. – gruszczy Apr 28 '15 at 15:23