izivkov / CasioGShockSmartSync

Apache License 2.0
116 stars 12 forks source link

action button not working and sync error Android 14 #75

Closed Lexvox closed 7 months ago

Lexvox commented 9 months ago

The action button doesn't work and I'm only able to connect once, after that I have to forget the watch in the app and connect again.

Steps to reproduce:

  1. open app
  2. connect watch as instructed
  3. all settings sync perfectly
  4. disconnect watch by short pressing either mode or 'action' button
  5. pressing the action button doesn't do anything
  6. try to connect watch again as instructed but watch displays 'ERR' in the top right matrix display after flashing 'CNCT' for 8 times, no reaction from the app
  7. press 'forget' in the app and connect watch again
  8. app works until watch is disconnected upon which watch won't connect again unless watch is forgotten in app

Expected behavior:

1.- 4. as above

  1. pressing action button launches set action
  2. watch can be reconnected without having to forget every time

If theres a way to send logs or provide u with other information please let me know.

Devices: GW-B5600 Pixel 7 Android 14 UQ1A.231205.015 App ver. 12.1

izivkov commented 9 months ago

OK, let us establish a baseline for the problem. Let me ask you a few things first:

  1. Is this a new behavior? Was it working before, or is this something you have experienced before?
  2. Please make sure the official app is not running on your phone or on phones in the proximity of the watch.
  3. Please make sure this app is not running on a phone in the proximity of the watch.
  4. Does the app work on another phone you might have?
  5. Do you have multiple watches?

I will look into the issue once I understand the situation better. Thanks for reporting this.

izivkov commented 9 months ago

A simple thing to try is to go the Android setting, and clear "Storage and Cahe" for the app, and see if this fixes the promle. In v12.1, we changed the way we store local data, this might be effecting it.

izivkov commented 9 months ago

If all else fails, somebody reported that they had to pair the watch manually once from the Android settings, and then it started working. We have tested the app with Android 14, so I assumed that this is something specific to their crDroid OS. It seems that some versions of Android 14 have extra security features that don't allow automatic pairing, or there is a bug in the OS. We are still investigating.

If you try to pair manually, go to Settings, select Bluetooth -> Pair new device, then long-press the lower-left button of the watch, and it will appear in the list of devices. Just pair it then

here is the link

Please let me know how it goes.

izivkov commented 9 months ago

Just keeping some notes here for future reference:

Location of DataStore data file: /data/data/org.avmedia.gshockGoogleSync/files/datastore/CASIO_GOOGLE_SYNC_STORAGE.preferences_pb

adb shell run-as org.avmedia.gshockGoogleSync cat /data/data/org.avmedia.gshockGoogleSync/files/datastore/CASIO_GOOGLE_SYNC_STORAGE.preferences_pb

Simmilar issue found here: https://issuetracker.google.com/issues/242755161

Lexvox commented 9 months ago

[SOLUTION:]

If all else fails, somebody reported that they had to pair the watch manually once from the Android settings ...

did that app works as expected now (cleared cache b4 for good measure)


  1. Is this a new behavior? [...]
  2. Please make sure the official app is not running on your phone or on phones in the proximity of the watch.
  3. Please make sure this app is not running on a phone in the proximity of the watch.
  4. Does the app work on another phone you might have?
  5. Do you have multiple watches?
  1. new user
  2. no official app installed, no other phones in vicinity
  3. "
  4. n/a
  5. no

A simple thing to try is to go the Android setting, and clear "Storage and Cahe" ...

same behavior as pressing 'forget' in app


... something specific to their crDroid OS ...

stock pixel rom, however custom linux-stable based kernel (5.10.197-Kirisakura_Raviantah_2.1.0), magisk 26.4, lsposed 1.9.2; if that matters

izivkov commented 9 months ago

Great, thanks for the feedback! I'll add this solution to a troubleshooting section. I'll continue to investigate why this is the case.i can only assume this is a new security feature to prevent apps from maliciously connecting via Bluetooth without the user's knowledge. It does not effect all Android 14 phones, so I'm not sure what is the difference.

I would be really curious how the official app behaves with your phone, but if you have not installed it before, I understand you might be reluctant to compromise your privacy.

Thanks again for reporting this.

Lexvox commented 9 months ago

I would be really curious how the official app behaves with your phone, but if you have not installed it before, I understand you might be reluctant to compromise your privacy.

Just tried both the 'classic' g shock connected and newer casio watches app and both work as expected. Once paired in app the watch and app reconnect without hiccup. Deleted the watch pairing from my phones bluetooth settings beforehand. So I'm guessing it's bug specific to your app.

izivkov commented 9 months ago

Ok, I'll look into it. Thanks.

On Sun, Feb 18, 2024, 12:14 PM Lexvox @.***> wrote:

I would be really curious how the official app behaves with your phone, but if you have not installed it before, I understand you might be reluctant to compromise your privacy.

Just tried both the 'classic' g shock connected and newer casio watches app and both work as expected. Once paired in app the watch and app reconnect without hiccup. Deleted the watch pairing from my phones bluetooth settings beforehand. So I'm guessing it's bug specific to your app.

— Reply to this email directly, view it on GitHub https://github.com/izivkov/CasioGShockSmartSync/issues/75#issuecomment-1951389297, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7M37XRT7EZFSHPLYSVRJTYUIZGFAVCNFSM6AAAAABDNVBDOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJRGM4DSMRZG4 . You are receiving this because you commented.Message ID: @.***>

izivkov commented 9 months ago

Sounds like you have some good technical skills. Could you help me narrow down the problem? I suspect it has something to do with the app storage. After connection, the Bluetooth (BT) ID of the watch is stored in the DataStore of the app. Next time, the app will reuse the same ID to connect to the watch until you clear the storage or press "FORGET".

Could you try the following:

  1. Unpair the watch and clear storage from Android settings.

  2. Set up ADB on your PC. Put your phone in "developer" mode and connect it to the PC via USB.

  3. Run the following to see the content of the app's data:

    adb shell
    run-as org.avmedia.gshockGoogleSync
    cat /data/data/org.avmedia.gshockGoogleSync/files/datastore/CASIO_GOOGLE_SYNC_STORAGE.preferences_pb

    You should see "File not found".

  4. Connect the watch to the phone for the first time. Run the above commands again. This time you should see something like:

    LastDeviceName*CASIO GA-B2100
    LastDeviceAddress*F6:A1:42:57:7A:07

    LastDeviceAddress is what holds the ID of the watch. Let me know if you see it.

Thanks

Lexvox commented 9 months ago
  1. cleared app, deleted pairing from phones bt setting
  2. looked up the file (nonexistent)
  3. after connecting (in app) it holds my watches id just like in ur xample,
  4. disconnected watch
  5. wont reconnect as before,
  6. without clearing the app or forgetting the watch in app I connected the watch through my phones bt settings and when I switched back to the app the interface was already up displaying the info as expected
  7. app works as expected again

also cleared and reconnected twice just to see if the phone changed the id for some reason (it didn't)

izivkov commented 9 months ago

Hello @Lexvox

If you are comfortable with it, do you mind building the branch new-ble and testing it with your Android 14? This should address the issue of having to press the "FORGET" button with every connection, without manually pairing the watch.

I replaced my own implementation of the BLE interface with this library. This is supposed to be the "gold standard" when referring to BLE libs, so I hope this fixes the issue.

If you prefer an APK, I can send you to test.

Thanks in advance.

Lexvox commented 9 months ago

Hi @izivkov

wouldn't mind building it but I'm currently on vacation and don't have my computer with me. But if you can send me an apk I'll gladly test it.

izivkov commented 9 months ago

Oh, sorry to bother you on vacation. Here is the APK, but please don't spend too much time on this, I can get somebody with Android 14 to test it.

Lexvox commented 9 months ago

I don't mind, not like I'm wasting any beautiful weather here and I enjoy the tinkering :) Unfortunately after going through initial setup the app crashes about a second after I attempt to connect a second time. It first reacts to the watch (loading animation plays) but it crashes before the interface comes up. Yet again the problem is solved by pairing the watch in the device settings first. I'll send you the crash log via email.

izivkov commented 9 months ago

Thanks for the log. I saw this error earlier, and I updated the APK. If you have time, download again give it another try. It does not happen for me. If it deos not work for you, I will post a messages on GitHub regarding this. One of the contributots with Android 14 will try to fix it.

It's actually good that it crashes now, we can find the cause easer running Android 14.

Thanks again Ivo

izivkov commented 7 months ago

Fixed