cagnulein / qdomyos-zwift

Zwift bridge for smart treadmills and bike/cyclette
https://www.qzfitness.com/
GNU General Public License v3.0
385 stars 110 forks source link

[BUG] Wear OS app not staying active #2489

Closed acepilot111 closed 1 month ago

acepilot111 commented 2 months ago

Describe the bug Wear OS app disconnecting

To Reproduce Steps to reproduce the behavior: Recently got a Galaxy Watch 7. Installed the QZ app on it so I can transmit my heart rate to the app on my phone. I can open the app and it auto starts and displays my heart rate. Then if I hurry I can open the app on my phone and it will auto connect to the bike and the app on my watch and properly display the HR in the app for a few seconds. However, once the watch screen turns off, the connection seems to break. The app on my phone displays whatever the HR was when the connection was lost.

One thing I noticed when installing it for the first time was it didnt ask for "all the time" level permissions. Only for while using the app. And I am unable to manually grant that level of permission to the app in the watch settings, at least that I could find. So, my guess is the OS is killing the app as soon as the screen auto turns off. I have also tried to turn on the setting that keeps the display on, but that didnt fix it either.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem. N/A

Desktop (please complete the following information):

Smartphone (please complete the following information):

Append a debug log I tried to capture this in the attached log, but not sure if HR or the connection gets logged. debug-Sun_Jul_28_17_16_24_2024.log

Additional context Add any other context about the problem here.

cagnulein commented 2 months ago

Awesome, thanks for the update!

Il giorno sab 10 ago 2024 alle 02:26 bigdbag @.***> ha scritto:

Can confirm latest works. I didn't actually work out so I only know that it's been working for about 60 seconds. Will be spinning for around 2 hours tonight so I'll post back here if it stays alive and updated the entire ride!

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2489#issuecomment-2278906044, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWACZTT5BA44RRHNK4TZQVM45AVCNFSM6AAAAABLTE66OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZYHEYDMMBUGQ . You are receiving this because you were mentioned.Message ID: @.***>

bigdbag commented 2 months ago

Ok so I completed my spin session. It exits to the home watch face after a couple seconds, but HR still tracks for some time afterward (maybe another 40 seconds). But at some point it cuts off and no longer tracks until you go back into the app on your watch again. I manually went to permissions for the app on my watch to turn on and give it all-the-time permissions, but that didn't make any difference.

cagnulein commented 2 months ago

The main difference between what I see in the simulator is that when the watch goes to low power mode, it still shows the heart rate period don't you have the possibility to see the same thing?

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno sab 10 ago 2024 alle 07:26 bigdbag @.***> ha scritto:

Ok so I completed my spin session. It exits to the home watch face after a couple seconds, but HR still tracks for some time afterward (maybe another 40 seconds). But at some point it cuts off and no longer tracks until you go back into the app on your watch again. I manually went to permissions for the app on my watch to turn on and give it all-the-time permissions, but that didn't make any difference.

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2489#issuecomment-2279380998, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWEZHWGDVLIN3LSORGTZQWP63AVCNFSM6AAAAABLTE66OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZZGM4DAOJZHA . You are receiving this because you were mentioned.Message ID: @.***>

bigdbag commented 2 months ago

Hm ok so when i put on power saving, it's interesting. HR shows up immediately without opening watch QZ app. When watch screen turns off the same behavior happens, which is that HR updates for a little bit before stopping. But now, all I need to do is wake up the watch to get HR to update again, instead of before when I had to open the watch QZ app and press the back button. So in some ways power saving mode improves the situation, but it's ultimately the same result, which is that watch screen off results in HR not responding after several seconds.

cagnulein commented 2 months ago

Ok, I'll check it out. I have for sure to buy the watch to understand this. i'm actually on vacation for the next 15 days so i will try my best

Il giorno dom 11 ago 2024 alle 02:11 bigdbag @.***> ha scritto:

Hm ok so when i put on power saving, it's interesting. HR shows up immediately without opening watch QZ app. When watch screen turns off the same behavior happens, which is that HR updates for a little bit before stopping. But now, all I need to do is wake up the watch to get HR to update again, instead of before when I had to open the watch QZ app and press the back button. So in some ways power saving mode improves the situation, but it's ultimately the same result, which is that watch screen off results in HR not responding after several seconds.

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2489#issuecomment-2282321677, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWEGBT5S2UPWA5WWP6DZQ2T3BAVCNFSM6AAAAABLTE66OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBSGMZDCNRXG4 . You are receiving this because you were mentioned.Message ID: @.***>

bigdbag commented 2 months ago

Hope you have great one! Gotta leave the laptop at home when you go on vacation :)

cagnulein commented 2 months ago

Unfortunately amazon doesn't ship here where I am on vacation. I will buy it when I get back at the end of the month

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno dom 11 ago 2024 alle ore 15:47 bigdbag @.***> ha scritto:

Hope you have great vacation!

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2489#issuecomment-2282766813, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWGZDP3UQSYLRMPMWE3ZQ5TOTAVCNFSM6AAAAABLTE66OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBSG43DMOBRGM . You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 2 months ago

@acepilot111 did you see the same thing too?

cagnulein commented 2 months ago

@bigdbag one question: when the HR is not updating anymore on the phone, do you still see the HR light on the back of the watch? if so it means the problem it was only the bluetooth communication. let me know

cagnulein commented 2 months ago

Hi guys I updated a new version with the alarm receiver, let me know if it's better

acepilot111 commented 2 months ago

Sorry I haven't responded in a few days. @cagnulein, no need to rush on any of this since you are on vacation. You need to take your time away from all this as a one-man army developer.

However, for when you get back, here is some info on what I have found. Yes, my experience has been the same as bigdbag. The app on my watch opens and stays open, then successfully broadcasts to the app on my phone. But eventually something stops working sometime after the watch screen goes off. The app on my phone acts like it is still getting a heart rate, but it just stays at the last rate it received from the watch. Until the watch screen comes back on and then the app on my phone immediately updates to a new heart rate and will keep track until sometime after the screen turns off again. Last two rides have a heart rate that looks like this...

image image

When a normal ride from a few weeks ago looks like this...

image

Also, to answer your question to bigdbag about the HR light, I checked while ridding this morning once I noticed the HR on my phone froze, then tried to carefully lift the watch up without activating the screen to see if the light was still on and it was. Checked again a few minutes later to confirm and it was still lit up.

Oh, and that was all while on 1.1.8. I am working on installing the latest version you dropped a few hours ago (1.1.10 it looks like) and will report back on how it goes after my next ride.

cagnulein commented 2 months ago

thanks @acepilot111 ok so for sure the issue is only the bluetooth side. let's see if my last patch put a fix on this too!

acepilot111 commented 2 months ago

Unfortunately, version 1.1.10 is crashing again. It asks for permissions and then closes. I try and open it again and I can see the app for less than a half second before it crashes to the home screen of the watch.

QZ Wear OS 08-13-24 0903.txt

cagnulein commented 2 months ago

Got it

08-13 09:03:35.285 24096 24096 E AndroidRuntime: java.lang.RuntimeException: Unable to create service org.cagnulen.qdomyoszwift.HeartRateService: java.lang.SecurityException: Caller org.cagnulen.qdomyoszwift needs to hold android.permission.SCHEDULE_EXACT_ALARM or android.permission.USE_EXACT_ALARM to set exact alarms.

Let me fix it!

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno mar 13 ago 2024 alle 16:11 acepilot111 @.***> ha scritto:

Unfortunately, version 1.1.10 is crashing again. It asks for permissions and then closes. I try and open it again and I can see the app for less than a half second before it crashes to the home screen of the watch.

QZ Wear OS 08-13-24 0903.txt https://github.com/user-attachments/files/16600849/QZ.Wear.OS.08-13-24.0903.txt

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2489#issuecomment-2286359925, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWA4X2CYDINFUGSX26TZRIHXXAVCNFSM6AAAAABLTE66OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBWGM2TSOJSGU . You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 2 months ago

Finally Google released a new emulator, let's see if I can replicate it

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno mar 13 ago 2024 alle 16:18 cagnulein @.***> ha scritto:

Got it

08-13 09:03:35.285 24096 24096 E AndroidRuntime: java.lang.RuntimeException: Unable to create service org.cagnulen.qdomyoszwift.HeartRateService: java.lang.SecurityException: Caller org.cagnulen.qdomyoszwift needs to hold android.permission.SCHEDULE_EXACT_ALARM or android.permission.USE_EXACT_ALARM to set exact alarms.

Let me fix it!

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno mar 13 ago 2024 alle 16:11 acepilot111 @.***> ha scritto:

Unfortunately, version 1.1.10 is crashing again. It asks for permissions and then closes. I try and open it again and I can see the app for less than a half second before it crashes to the home screen of the watch.

QZ Wear OS 08-13-24 0903.txt https://github.com/user-attachments/files/16600849/QZ.Wear.OS.08-13-24.0903.txt

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2489#issuecomment-2286359925, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWA4X2CYDINFUGSX26TZRIHXXAVCNFSM6AAAAABLTE66OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBWGM2TSOJSGU . You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 2 months ago

Unfortunately not a big update from Google, same issue (I can't replicate your crash there)

So let's stick to the original plan: I fixed the crash issue hopefully on the last one on the 1.1.11

Let me know! @acepilot111

cagnulein commented 2 months ago

any news @acepilot111 ?

bigdbag commented 2 months ago

Sorry guys I've been out of pocket with life. This update works! Or at least it lasted for 2 minutes with the watch screen turned off, no AOD, no power saving enabled. Just straight up regular use of the app. I will be spinning in a little bit so I can test it for an actual session. If I don't respond that means either my fat body had a heart attack or it's working and there's nothing left but to deploy this baby to production play store :)

cagnulein commented 2 months ago

Amazing @bigdbag ! @acepilot111 are you experiencing the same?

bigdbag commented 2 months ago

Just worked out for an hour and a half on my human hamster wheel, all is well. Worked like a charm! I will say that there is no way to... stop tracking? besides going to app switch and swiping away the watch app to kill it. Not a deal breaker by any means, but maybe something to note as a backlog item. Thanks for your efforts @cagnulein and @acepilot111 <3

cagnulein commented 2 months ago

Wow that's amazing! @bigdbag yes I can add a stop start button now that it works! I will update it ASAP!

acepilot111 commented 2 months ago

I finally had a chance to use my spin bike this morning and can also confirm 1.1.11 seems to work as expected for the most part. It stay connected and kept the HR updated in the phone app during the whole ride.

cagnulein commented 2 months ago

Awesome, thanks for the update!

Il giorno ven 16 ago 2024 alle 17:28 acepilot111 @.***> ha scritto:

I finally had a chance to use my spin bike this morning and can also confirm 1.1.11 seems to work as expected for the most part. It stay connected and kept the HR updated in the phone app during the whole ride.

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2489#issuecomment-2293717906, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWFBHRK2PFP2APE7SXLZRYLDBAVCNFSM6AAAAABLTE66OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTG4YTOOJQGY . You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 2 months ago

@acepilot111 @bigdbag pushed the 1.1.12 with the possibility to start and stop the HR service. Let me know if it's working correctly

bigdbag commented 2 months ago

Sorry once again away for work, will give it a try tonight assuming I have the energy to spin!

acepilot111 commented 2 months ago

I finally managed to use it this morning. Saw the start stop button. It seemed to work ok. Still the occasional drop in connectivity, but way way better than it was before the last big fix you made.

image

cagnulein commented 2 months ago

that's great! i guess i will leave you play with it for another week and i will push it to production! thanks again for everything!

bigdbag commented 2 months ago

stop/start works from what i can tell, will keep testing as well!

stale[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

cagnulein commented 2 days ago

hi guys @bigdbag @acepilot111 @acgourley are you still using it? I didn't change anything in the code but i'm getting several users feedback about the fact that the app can't read the HR anymore. I'm guessing something is changed on WearOS? Could you please provide me a feedback? Thanks!

acepilot111 commented 2 days ago

I used it just this morning and it worked ok for me. A few connection drops throughout the workout, but still worked overall.

Here is the graph from Strava:

[cid:6b420c36-20f6-4890-841d-1db98ffd9875]

My phone's Samsung Health version is 6.27.2.009 Watch Wear OS version is 5.0 OneUI version is 6.0

Let me know if there is any additional informtion you want that could be helpful.

Nathan Hamilton


From: Roberto Viola @.> Sent: Thursday, October 17, 2024 7:06 AM To: cagnulein/qdomyos-zwift @.> Cc: acepilot111 @.>; Mention @.> Subject: Re: [cagnulein/qdomyos-zwift] [BUG] Wear OS app not staying active (Issue #2489)

hi guys @bigdbaghttps://github.com/bigdbag @acepilot111https://github.com/acepilot111 @acgourleyhttps://github.com/acgourley are you still using it? I didn't change anything in the code but i'm getting several users feedback about the fact that the app can't read the HR anymore. I'm guessing something is changed on WearOS? Could you please provide me a feedback? Thanks!

— Reply to this email directly, view it on GitHubhttps://github.com/cagnulein/qdomyos-zwift/issues/2489#issuecomment-2419356618, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BKFF37CXVGO7QDESFMC2BGLZ36R5JAVCNFSM6AAAAABLTE66OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJZGM2TMNRRHA. You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 2 days ago

Thanks for the feedback!

Il giorno gio 17 ott 2024 alle 15:47 acepilot111 @.***> ha scritto:

I used it just this morning and it worked ok for me. A few connection drops throughout the workout, but still worked overall.

Here is the graph from Strava:

[cid:6b420c36-20f6-4890-841d-1db98ffd9875]

My phone's Samsung Health version is 6.27.2.009 Watch Wear OS version is 5.0 OneUI version is 6.0

Let me know if there is any additional informtion you want that could be helpful.

Nathan Hamilton


From: Roberto Viola @.> Sent: Thursday, October 17, 2024 7:06 AM To: cagnulein/qdomyos-zwift @.> Cc: acepilot111 @.>; Mention @.> Subject: Re: [cagnulein/qdomyos-zwift] [BUG] Wear OS app not staying active (Issue #2489)

hi guys @bigdbaghttps://github.com/bigdbag @acepilot111< https://github.com/acepilot111> @acgourleyhttps://github.com/acgourley are you still using it? I didn't change anything in the code but i'm getting several users feedback about the fact that the app can't read the HR anymore. I'm guessing something is changed on WearOS? Could you please provide me a feedback? Thanks!

— Reply to this email directly, view it on GitHub< https://github.com/cagnulein/qdomyos-zwift/issues/2489#issuecomment-2419356618>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/BKFF37CXVGO7QDESFMC2BGLZ36R5JAVCNFSM6AAAAABLTE66OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJZGM2TMNRRHA>.

You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2489#issuecomment-2419599902, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWFHYL7KHNEP5SQ7DZDZ365YRAVCNFSM6AAAAABLTE66OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJZGU4TSOJQGI . You are receiving this because you were mentioned.Message ID: @.***>

bigdbag commented 2 days ago

hi guys @bigdbag @acepilot111 @acgourley are you still using it? I didn't change anything in the code but i'm getting several users feedback about the fact that the app can't read the HR anymore. I'm guessing something is changed on WearOS? Could you please provide me a feedback? Thanks!

I've been out of town for work for quite some time, unfortunately I cannot help at this time. I will say that I haven't gotten a WearOS update since I last checked in here.