Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch-initiated time sync not functional #17

Closed
BryanJacobs opened this issue Oct 29, 2022 · 17 comments
Closed

Watch-initiated time sync not functional #17

BryanJacobs opened this issue Oct 29, 2022 · 17 comments
Assignees

Comments

@BryanJacobs
Copy link

This app does not automatically send time to the watch when the watch connects. It should do that, because without doing that, watch-initiated automatic time sync does not work. If you think there are people out there who wouldn't want the time sync to be automatic, you could add an option to disable it, but... I don't see why this wouldn't be an "always" thing on connection.

As a side note, it would also be nice if there were an intent to reliably launch the app in the background. Right now I have automation launch the app and then send it away, but it'd be better if I could ensure the app were running for automatic time sync from phone -> watch.

To Reproduce
Steps to reproduce the behavior:

  1. With a GW-B5600 watch, enable "automatic time sync".
  2. Launch the G-Shock Smart Sync app with Bluetooth enabled.
  3. Wait until 00:30:30, 06:30:30, 12:30:30, or 18:30:30 exactly by the watch's time
  4. Witness the watch rapidly connect to the phone and then disconnect, but not sync time (no "recv" text on display)

Expected behavior
The watch should automatically sync with the phone four times per day.

@izivkov
Copy link
Owner

izivkov commented Oct 29, 2022

Thanks, I will look into it.

I was under the impression that when auto-syncing, the app will run its actions. (The app cannot tell difference between auto-connect or short-press lower-right button). If one of your action is "Set Time", the time will be set. In addition, the user may want to sync watch's reminders, etc, so this is a more flexible way to sync other things in addition to time.

As you say, there maybe a difference between button connection and auto-connection. I will find out, and then we can decide whether to run actions, or set time only. This app is not an exact copy of the official app, so I did not try to emulate all functionalities. After all, time sync is just a short press away, by setting an action to set time, and running the action. But good features should be implemented.

About the app running at the background, this is done in other apps by setting a notification, which always shown on the top of the phone. I personally find this very annoying, and this is why I did not implement it. Hope we can hear form other users about this.

@izivkov izivkov self-assigned this Oct 29, 2022
@BryanJacobs
Copy link
Author

I do have "set time" as the only action for custom actions, and it's not happening when the watch auto-connects. If I click the button in the app it works fine.

Personally, I don't particularly want to use the phone at all. I just want the watch to keep perfectly correct time without my interacting with anything manually. I live outside the radius covered by the atomic clock radio stations, so syncing from my phone is the best way to have a perfect watch.

On Android 12, a background notification can be reduced to one line ("minimized"), making it no substantial problem, but that wasn't exactly what I was asking for. I'm fine launching the app using automation, it would just be nice if there were a way to launch it with a non-foreground activity via an Intent. It only needs to stay running for ~2m for the watch to sync, not continually.

@izivkov
Copy link
Owner

izivkov commented Oct 29, 2022

Just to clarify about the last point - is this activity something you would write yourself, or is it an android setup?

@BryanJacobs
Copy link
Author

Goal: When the phone's bluetooth is enabled, any time the automatic sync on the watch runs, the watch time is set.

Possible implementations in descending order of convenience:

  1. Whenever a paired watch BT-connects to the phone, the app pushes time, even if the app is not running all. Unsure this is possible at all with Android - I don't know you can run the app on every BT device connect.
  2. Whenever a paired watch BT-connects to the phone while the app is running, the app pushes time to the watch. The app can be launched in the background via an Intent. I use automation outside the app to send the Intent. (answering your question: the code for receiving the Intent and using a non-background Activity need to be in the app; the code for sending the Intent is in automation software outside the app).
  3. Whenever a paired watch BT-connects to the phone while the app is running, the app pushes time to the watch. The app has a "scheduled run mode" where it launches itself at particular times. This is not great because who wants to write another scheduler.
  4. Whenever a paired watch BT-connects to the phone while the app is running, the app pushes time to the watch. I use automation outside the app to launch the app's MainActivity on a schedule. This is not great because the app actually pops up on the phone screen four times a day, which is annoying.

Hope that answers your question?

@izivkov
Copy link
Owner

izivkov commented Oct 30, 2022

Ok, thanks for your input.

@izivkov
Copy link
Owner

izivkov commented Nov 8, 2022

For some reason, my watch stopped auto-updating time. I have it set to auto-update, and have stopped setting the time from any app for 3 days already, but the watch will not try to update the time at 6:30:30, etc. Any body knows why? I need to capture what happens during auto-update to add this feature.

@BryanJacobs
Copy link
Author

BryanJacobs commented Nov 8, 2022

Have you made sure the watch is in an area where it can't receive time from an atomic clock LF radio signal?

Have you made sure to be looking at the watch for the full minute, to see if it did attempt to sync? The face will display the attempt, but it only lasts a few seconds - blink and you'll miss it. Attempts are in my experience at 30 seconds after the nominal mark, but the manual doesn't say that... it just says "around 12:30" etc.

Note that the watch's sync behaviors are time-zone-dependent... like, the time zone the watch is set to affects whether it thinks it should try to atomic-clock-radio-sync (and does that also mean BT sync? No idea).

Beyond that, no idea, sorry.

@izivkov
Copy link
Owner

izivkov commented Nov 14, 2022

I was finally able to get my watch to sync automatically, by resetting it back to factory defaults, and waiting for a couple of days after manual setting. (I have only tried the 6-band sync, not the BT, but it should work with BT as well). There is a slightly different behaviour now: short pressing the lower-right button does nothing, You have to hold the button for about 3 seconds to set time manually. Not sure why this is the case, maybe somebody can clarify.
I am travelling at the moment,and plan to address this issue early Dec. when I get back.

@izivkov
Copy link
Owner

izivkov commented Dec 7, 2022

These features were added:

  • Add the ability to auto-sync the watch's time periodically initiated from the watch (4 times per day)
  • In addition to time update, the calendar events are are also updated periodically.
  • Fixed an issue with actions. If the action button was pressed a second time to run actions again, the second attempt failed. Now this is working.
  • Added ability to enable/disable auto-time sync in Settings.

@BryanJacobs: You may want test the auto-sync feature and let me know if you are having any issues before I close this Bug. Thanks.

@BryanJacobs
Copy link
Author

I've commented out your code making it take a picture every time, and will test over the next few days.

@BryanJacobs
Copy link
Author

Automatic syncing works, thanks! The time set is off by around three seconds (the watch is set to a time slightly in the past), likely due to the lack of offset accounting for latency in the logic that pushes the time to the watch, but with this I can rely on my phone to keep the watch from drifting too far.

Thanks again!

@izivkov
Copy link
Owner

izivkov commented Dec 10, 2022

@BryanJacobs
OK, great! I'm aware of the time offset, but my phone is usually between 0 and 2 seconds off anyway. It is possible to use NTP, but then we have to deal with making sure the phone has connectivity to the internet and deal with it. Maybe we can look into doing this in the future.

I forgot to mentions, you can disable the auto-time adjustment in the settings now.

I have cleaned up the code a little, you may want to get the latest.

Finally, would you consider sharing your method of waking up the app periodically to get the time? Is is some kind of cron script, or some manual setup on your phone? I think people would find it useful. If it is a script, you can fork the project and submit as a PR if you like. Of if you don't want bother with PR, just add it here, and I will incorporate it. If it is a manual setup on the phone, you can update the README file in a similar manner.

Thanks

@BryanJacobs
Copy link
Author

I meant the watch ends up at around -3s relative to the phone, not relative to some outside concept of time. You can test yourself and see - watch when the phone transitions to a new minute vs when the watch does after a sync.

@BryanJacobs
Copy link
Author

I wake up the app using the app Tasker, available on the play store.

@izivkov
Copy link
Owner

izivkov commented Dec 10, 2022

OK, thanks. I will look into the delay. I usually see about a second delay. 3 secs is a bit too much.

@izivkov
Copy link
Owner

izivkov commented Dec 10, 2022

I will close the issue now.

@izivkov izivkov closed this as completed Dec 10, 2022
@izivkov
Copy link
Owner

izivkov commented Dec 10, 2022

I updated to code to adjust for the 3-sec delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants