Friday, October 20, 2017

Android Wear Success ( or Not)


Here's what happens when you make a device without any programmer access...
Luckily, hot glue is reversible with alcohol.

To make everything work, I needed to reprogram my device to send out the isig every 5 minutes.  This way, another device (the watch) can listen for a notification.  I originally wrote this, years ago, to only send a response to a request, but this isn't really how BTLE wants to work.

Finally success with android wear.  The end result looks exactly like my last post.  Unfortunately, I can't really see those numbers without reading glasses, so I'm stuck with a custom watch face and bigger numbers.  I'll work on that, I'm still trying to figure out complications, they only work by accident now.

As to the android studio issues, here's what to do when it starts acting up.
To connect to the watch you do "adb connect {watch ip address}".  This should connect quickly.
Signs that you're screwed are the following:
- can't connect to the watch, and you get various meaningless errors
- studio hangs, windows crashes etc
- studio tells you it can't put the apk on the watch etc.
- you deploy code, but the debugger doesn't stay connected so no logging

First, toggle wifi off/on on the watch, then try the connect statement.  That generally fixes things.  If problems persist, restart everything.  Your PC, the watch and your router.  It will work for up to a week after that.  Also, you probably need to wake the watch up to program, otherwise Android Stuido will just sit there.  Not exactly user friendly.

I'm using the Sweet Blue bluetooth libraries.  That got me around allot of headaches.  One strange thing, the device name has to be LOWER case.  The device is programmed in UPPER case, and you can confirm that with a bluetooth scanner, but you need lower case for sweet blue.

Complications, aptly named, when developing this, I had no issue pushing a value to the complication and having the screen refresh immediately.  In practice, there is a delay, not enough that I care, the vibratory alerts happen real time, and you can tap the display to get the current value, but they can lag a few minutes.  Another issue on the programming side, if I update the code on the watch, the bluetooth doesn't always start up again, it binds the device, but no values show up.  Solution, restart the watch.

Well, that's it, I'll  update this post when I've figured out what the battery life is going to be.  The CC2500/RFduino device is good for 24 hours, I'm hoping the watch will hold out for a full day.
-----------
10 hours, and the battery indicator was at 50%...  I'll try again with WIFI off.
-----------
11/27... Basically, this is a failure.  Only works for a few hours at best, appear to be fighting with power management.  Most telling thing I've noticed, at some point when the watch has been untouched, the "Tick" event stops (every minute an event normally fires).

No comments:

Post a Comment