NightscoutFoundation / xDrip

Nightscout version of xDrip+
https://jamorham.github.io/#xdrip-plus
GNU General Public License v3.0
1.4k stars 1.14k forks source link

Support for Android Wear 2.0 Complications #101

Closed pimeys closed 7 years ago

pimeys commented 7 years ago

Hi,

Android Wear 2.0 is coming very soon for many smart watch owners and it has one pretty cool API to use with xDrip+: the Watch Face Complications[0]. I already branched and started working on it, thinking that it would be quite easy: the class just needs to extend the ComplicationProviderService and implement an asynchronious method onComplicationUpdate, allowing the user to display xDrip data on any Android watchface, basically removing the need for separate watchfaces only for xDrip.

I realized the current watchfaces take the value updates as callbacks from the xDrip running on the mobile phone, but here the watchface itself should trigger the updates and the new provider should reply with the values the watchface wants to display. This made me think for a while... I either need:

Both of the options mean the values are a bit older than the ones on the phone or the watch is using more battery if it asks for new data too often.

I'd like to hear some ideas how to move forward and if any of these two options is the way to go, some hints how on earth the value update works between the watch and the phone. The prize is basically to create infinite amount of different possibilities how the watch looks like while still having the most important information visible.

Regards, Julius

[0] https://developer.android.com/wear/preview/features/complications.html

tswire commented 7 years ago

Fyi. Got the arrow and delta as I had to uninstall a d reinstall the xdrip on the watch itself. Can the font be made bigger or is that dependent on the complication and watchface?

On Sep 15, 2017 10:21 AM, "Jamorham" notifications@github.com wrote:

@recursive-descent https://github.com/recursive-descent I wonder if it can be related to your collector, what data source is the phone that the watch is connected to using to get glucose data?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NightscoutFoundation/xDrip/issues/101#issuecomment-329796845, or mute the thread https://github.com/notifications/unsubscribe-auth/ActA9vc6usOuxZU-MUxyB6NeEBmymSfGks5siofzgaJpZM4M4KE6 .

badgerisop commented 7 years ago

This is a bit off topic but does anyone know if it's even possible to convert the Nightwatch app (or add a similar thing for xDrip) to only be on the watch for the purposes of using it to access Dexcom share data?

I use my AW with iOS for what it's worth.

Sent from my iPhone

On Sep 15, 2017, at 10:49 AM, tswire notifications@github.com wrote:

Fyi. Got the arrow and delta as I had to uninstall a d reinstall the xdrip on the watch itself. Can the font be made bigger or is that dependent on the complication and watchface?

On Sep 15, 2017 10:21 AM, "Jamorham" notifications@github.com wrote:

@recursive-descent https://github.com/recursive-descent I wonder if it can be related to your collector, what data source is the phone that the watch is connected to using to get glucose data?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NightscoutFoundation/xDrip/issues/101#issuecomment-329796845, or mute the thread https://github.com/notifications/unsubscribe-auth/ActA9vc6usOuxZU-MUxyB6NeEBmymSfGks5siofzgaJpZM4M4KE6 .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

jamorham commented 7 years ago

Any chance of some photos so I can see how it looks? Thanks.

heygar commented 7 years ago

screen

I've got an Asus Zenwatch 3. It's also not updating when I'd expect it to, but I'm still experimenting with the settings. I have it on there twice so the hands aren't blocking it at 12, 3 and 9 :)

tswire commented 7 years ago

Sorry for the bad pick and can't figure out how to rotate it!

20170915_113047 002

heygar commented 7 years ago

I tried removing one of the data points (at 12:00) and re-adding it. Now it looks like this (notice the temperature changed, but the CGM reading did not): screen

jamorham commented 7 years ago

I will have another look at the updating code to see if I can get it to work properly for everyone. It is supposed to notify the watchface to come and get the data when new data arrives.

I am assuming that tapping on the complication doesn't cause it to update?

recursive-descent commented 7 years ago

@jamorham https://github.com/jamorham The phone (pixel w/Android 8.0.0) is running xdrip+ with a G5 data source.

On Fri, Sep 15, 2017 at 9:21 AM, Jamorham notifications@github.com wrote:

@recursive-descent https://github.com/recursive-descent I wonder if it can be related to your collector, what data source is the phone that the watch is connected to using to get glucose data?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NightscoutFoundation/xDrip/issues/101#issuecomment-329796845, or mute the thread https://github.com/notifications/unsubscribe-auth/AZ_4SA7zRxRBFVckXDauDUY3ZgYazEd2ks5siofzgaJpZM4M4KE6 .

heygar commented 7 years ago

Tapping the complication had no effect. I tried restarting the watch thinking maybe some stuff just needed to gel. And we should always try turning it off and back on again. Now, both data points read old/null and refuse to update :(. But, it is getting warmer!

I'm using G4 with the xBridge Wixel. screen

recursive-descent commented 7 years ago

Here's a screen print of mine.[image: Inline image 1]

On Fri, Sep 15, 2017 at 11:31 AM, Gar notifications@github.com wrote:

Tapping the complication had no effect. I tried restarting the watch thinking maybe some stuff just needed to gel. And we should always try turning it off and back on again. Now, both data points read old/null and refuse to update :(. But, it is getting warmer!

I'm using G4 with the xBridge Wixel. [image: screen] https://user-images.githubusercontent.com/16446666/30493347-5c3fedb2-9a09-11e7-9a07-83a4d36d83e6.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NightscoutFoundation/xDrip/issues/101#issuecomment-329832989, or mute the thread https://github.com/notifications/unsubscribe-auth/AZ_4SJPMZJn4HNw7_2MSVrxLukv_Htseks5siqZ7gaJpZM4M4KE6 .

tswire commented 7 years ago

Something I noticed is that when the collector (my phone) has stopped getting readings (which happens a lot on Galaxy S8 due to bluetooth turning off) the complication showed old/null. Once I got my phone getting readings again, the complication immediately updated. So not sure if this is related or not but definitely something to look at. Also, a bit off topic but I cannot find the "correct" bluetooth/xdrip settings that work best for Samsung Galaxy S8+....still getting random disconnects and capture rate has never been that good. Any ideas?

recursive-descent commented 7 years ago

More info. The xdrip+ app on the phone "always" receives the G5 and updates accordingly.

On Fri, Sep 15, 2017 at 12:09 PM, tswire notifications@github.com wrote:

Something I noticed is that when the collector (my phone) has stopped getting readings (which happens a lot on Galaxy S8 due to bluetooth turning off) the complication showed old/null. Once I got my phone getting readings again, the complication immediately updated. So not sure if this is related or not but definitely something to look at. Also, a bit off topic but I cannot find the "correct" bluetooth/xdrip settings that work best for Samsung Galaxy S8+....still getting random disconnects and capture rate has never been that good. Any ideas?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NightscoutFoundation/xDrip/issues/101#issuecomment-329842049, or mute the thread https://github.com/notifications/unsubscribe-auth/AZ_4SHZDc17s3P2SBlsj0EeE0KNYyR0_ks5siq88gaJpZM4M4KE6 .

apabari commented 7 years ago

Just doing some reading on this and came across this thread. Wish I had a better knowledge of android development to lend more technical support in this area.

@tswire - It's not clear to me from this thread, but did you find the answer to what you were looking for?

I know a few people who would be very interested in connecting an android watch to an ios device, and them using a simple watchface (something like NightWatch) to 'follow' the blood sugars of someone else.

Please let me know if this is now possible, and if so, any guidance on how to set this up would be much appreciated.... thank you!

tswire commented 7 years ago

@apabari - Sorry, I know it's not clear because I was using an iOS device with Android Wear watch and was hoping for a solution to have something work on AW2 while paired to iPhone...however, I switched to Samsung Galaxy S8+.....so now I am just testing the complication implementation by these awesome guys!!! FYI, working ALL day with no hiccups on my watch....updates as the phone app updates and been great. Was able to work with PujiBlack watch face and customized it to show complication of my sugars!! yes...12.9 mmol is a bit high so no comments :-) 20170915_162807 002

heygar commented 7 years ago

Not sure if it helps in your debugging, but if my phone has a valid value and my watch reads old/null, tapping on the complication does nothing. If my watch has a valid value, but from a long time ago (greater than 5 minutes) and my phone has also timed out has a line through the value, then tapping on the complication changes the watch to read old/null. So tapping on the complication is having some effect. I just don't know what it's doing. It won't update to the correct value, but it will tell me that the value is old. Very odd. I blame it on Android Wear.

heygar commented 7 years ago

To further obfuscate things, I can get the complication to update by disabling, then enabling the "Enable Wear Collection Service" on the phone. If I leave it disabled, it doesn't update and if I leave it enabled, it doesn't work. The only time it updates is if it's disabled (no check mark) and I enable it (check mark added).

I can set myself I reminder to disable and enable every 5 minutes :)

apabari commented 7 years ago

@tswire - Thanks. That's disappointing for me, but I am glad you now have a working solution.

I do hope someone is able to come up with a working solution for iPhone users with Android watches though.

pimeys commented 7 years ago

Can confirm the issues. Started a new G4 sensor today morning, and after the two hour wait

I need to say that with the old sensor, before having a two-hour pause with the measurements, all was working perfectly.

recursive-descent commented 7 years ago

As of release "build 18th Sep 2017" I'm getting complication updates for every transmission.

[image: Inline image 1][image: Inline image 2]

heygar commented 7 years ago

Updated today to today's build Sep 19. Really like the old/39 display. I assume that's the minutes since the last read. screen

Unfortunately, I watched the watch face change from old/34 to old/39 while my phone said, "91 1 minute ago". Good news is the watch face complication is updating! Bad news is it's not grabbing the actual blood sugar value. I verified I can still get it to update by turning off/on the "Enable Wear Collection Service" (most of the time).

-- Right after I finished clicking the Add Comment button, my watch face successfully updated without intervention! Maybe is just needed all the bit fluxes to work themselves out.

pimeys commented 7 years ago

@heygar That value is minutes since the last read, yes. It's for debugging purposes for now, we actually have no idea why the complication provider can't get the new values from the database. Feel free to join in Gitter if you want to help...

tswire commented 7 years ago

Awesome work here guys. Not sure if each watch is different in terms of complications and/or bluetooth connection to phone but I have had no issues from the first build that included complications. Each build after I had no changes and watchface complication always has data. The ONLY time it did not is when the actual collection service on phone was not working with G5 for a bit. I have Tag Connected 45 with Samsung G8+ and working very very well.

pimeys commented 7 years ago

My problems started when I changed a new sensor for G4 and waited that two hours warm-up. After that the value doesn't update anymore. The only way to get the latest value is by tapping Reset Wear DB from the phone.

tswire commented 7 years ago

@pimeys where is the Gitter site you mentioned a couple posts back?

pimeys commented 7 years ago

@tswire https://gitter.im/jamorham/xDrip-plus

tswire commented 7 years ago

Thanks.

For those working on this can you see if you can add the decimal with a 0 after any reading showing that is even (ie 8.0 or 7.0 rather than 8 or 7)?

On Sep 19, 2017 11:27 AM, "Julius de Bruijn" notifications@github.com wrote:

@tswire https://github.com/tswire https://gitter.im/jamorham/xDrip-plus

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NightscoutFoundation/xDrip/issues/101#issuecomment-330574642, or mute the thread https://github.com/notifications/unsubscribe-auth/ActA9p3kDIU8UQMiOZIVhCJF3m7PKTonks5sj9vlgaJpZM4M4KE6 .

tswire commented 7 years ago

Well crap, spoke too soon. Firmware updated on my Tag last night and now I am getting exact same issues of NULL XXX unless I force something with resetting Wear DB or uncheck and check wear collector.

jamorham commented 7 years ago

Please everyone test the 29th Sept nightly. We believe this resolves the issue with complications failing to update.

recursive-descent commented 7 years ago

It is working flawlessly now. Readings always update. Direction arrows working as well.

On Sep 29, 2017 11:57 AM, "Jamorham" notifications@github.com wrote:

Please everyone test the 29th Sept nightly. We believe this resolves the issue with complications failing to update.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NightscoutFoundation/xDrip/issues/101#issuecomment-333180727, or mute the thread https://github.com/notifications/unsubscribe-auth/AZ_4SAV1ZM8-m9gI-H5KrFFOpQ3yaXkqks5snSGBgaJpZM4M4KE6 .

pimeys commented 7 years ago

Working like a charm here too. Just would like some idea what does different shortenings mean now. I get sometimes for the bottom part stuff like 2S or 1S instead of a delta.

jamorham commented 7 years ago

Okay so the way it currently works is there are two different views of the complication.

By tapping slowly on these you can alternate between them. I think all complications will update to reflect the last change you had. So if you have multiple on a watchface and you change one, the other(s) will switch to that mode as well on the next update.

If you tap twice within one second (but not too fast) then it will bring up the treatment entry keypad and the complication should stay on the mode it was on.

There may be more useful modes possible in the future. It should be relatively easy for someone else to modify the CustomComplicationProviderService class now that the core functionality is working. The time since information may not be that useful because the complication doesn't update that frequently. But I used it for debugging mainly.

pimeys commented 7 years ago

Alles gut! Been working like a charm today. Thanks for finding a nice solution.

jamorham commented 7 years ago

Marking as resolved.

dballard8 commented 7 years ago

Anyone that can help me with this?

JayBouch1977 commented 6 years ago

I would love to chat with you tswire, please tell me you are still there. I need informations concerning Tag Heuer

tswire commented 6 years ago

Hey. I no longer use android or android wear so stopped following. However I still may be able to help. What’s up?


From: JayBouch1977 notifications@github.com Sent: Monday, July 9, 2018 8:58 p.m. To: NightscoutFoundation/xDrip Cc: tswire; Mention Subject: Re: [NightscoutFoundation/xDrip] Support for Android Wear 2.0 Complications (#101)

I would love to chat with you tswire, please tell me you are still there. I need informations concerning Tag Heuer

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/NightscoutFoundation/xDrip/issues/101#issuecomment-403665285, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ActA9jCdVKUYbFj2eHKxepm2Q9cFN79Jks5uE_wzgaJpZM4M4KE6.

Parki79 commented 6 years ago

tswire - I am considering getting a Tag connected. Could you confirm this device still runs xdrip+?

Do you have a basic guide of how you got it to work together? Can you use the watch with the sensor + maio maio without having the phone?

I have been looking at the connected for a few weeks but just wanted to be confident it would be suitabke before I purchased.

JayBouch1977 commented 6 years ago

Hello all, I have a question concerning the wear 2.0 and xdrip complication.

I have Xdrip installed on my watch and i can easily chhose between seeing my blodd sugar on an interactive watch face (in a cricle on the main watch face) or having Xdrip directly as a watch face (with the graphic and numbers).

My question: I was wondering if there is a way to acces the graphic by clicking on the watch face complication? When i click on the watch face complication now, what it does is changing the number of second since last BG received or having the difference between last BG and new BG), what i would likc is getting the app showing graphic when i click on the watch face complication.

Thank you, i hope it is clear :)