Code Monkey home page Code Monkey logo

dnd-sync's Introduction

DNDSync

This App was developed to enable Do Not Disturb (DND) synchronization between my Pixel phone and the Galaxy Watch 4 since this option was only available if paired with a Samsung phone.

If installed on phone and watch it enables either a 1-way sync or a 2-way sync, depending on the preferences. I also added the functionality to automatically toggle Bedtime Mode. Use case: At night I put my phone into DND and I want my watch to automatically enable Bedtime Mode. This functionality is realized via an Accessibility Service, since I couldn't find how to enable it programmatically (any hints are highly appreciated).

NOTE: For Bedtime mode toggle to work it is important that on the watch the Bedtime Mode button is on the first page of quick settings and the middle button in the first row!

Part of this project is inspired by blundens work, please check their GitHub if you want to know more.

Tested on Pixel 3a XL paired with a Galaxy Watch 4 (40mm)

DNDSync demo

Video link: https://youtu.be/rHy6kCBNOzA

Setup

For now the App is not in the Play Store. Manual installation is required. The use of ADB is required.

  • Download the .apk files from the release section (dndsync_mobile.apk and dndsync_wear.apk)

Phone

  • Install dndsync_mobile.apk on the phone adb install dndsync_mobile.apk
  • Open the App and grant the permission for DND Access by clicking on the menu entry DND Permission. This will open the permission screen. This Permission is required so that the app can read and write DND state. Without this permission the sync will not work.
  • With the switch Sync DND state to watch you can enable and disable the sync. If enabled a DND change on the phone will lead to DND change on the watch.

Watch

Setting up the watch is a bit more tricky since the watch OS lacks the permission screen for DND access. I found a way to enable the permission via ADB.

Note: This is only tested on my Galaxy Watch 4 and it might not work on other devices!

  • Connect the watch to your computer via adb (watch and computer have to be in the same network!)
    • enable Developer Options: Go to Settings -> About watch -> Software -> tap the Software version 5 times -> developer mode is on (you can disable it in the same way)
    • enable ADB debugging and Debug over WIFI (in Settings -> Developer Options)
    • note the watch IP address and port, something like 192.168.0.100:5555
    • connect to the watch with adb connect 192.168.0.100:5555 (insert your value!)
  • install the app adb install dndsync_wear.apk
  • grant permission for DND access
    adb shell cmd notification allow_listener de.rhaeus.dndsync/de.rhaeus.dndsync.DNDNotificationService
    This allows the app to listen to DND changes and changing the DND setting
  • scroll to the permission section and check if DND permission says access granted (you might need to tap on the menu entry for it to update)
  • IMPORTANT: Disable ADB debugging after you are done because it drains the battery!
  • If you want to use the Bedtime mode feature you have to enable the Accessibility service for the app. Clicking on Accessibility Service will open the setting on your watch. Go to Installed Services and enable DNDSync. The App will use this to simulate the following touch events on the screen: swipe down to open Quick Settings Panel, click the middle icon of the first row (put Bedtime Mode here) and finally close the panel. You can enable this by enabling the Bedtime Mode Setting in the App.
  • If you enable the setting Sync DND in the App a DND change on the watch will lead to a DND change on the phone
  • If you enable the setting Vibration in the App the watch will vibrate when it receives a DND sync request from the phone

Feedback

Feel free to contact me for questions, feature ideas or bugs and I will see if I can do something about it

email: [email protected]

dnd-sync's People

Contributors

rhaeus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dnd-sync's Issues

Bedmode triggering on dnd

When I my phone is put into dnd by an app, the automation for bedtime mode triggers on the watch.

Not sync to watch4

Hello, i set up everything. In the apps on the phone and the watch 4 i see that the permission are granted.

Sync from watch to phone is working but not the sync from phone to watch.

What can I have made wrong?

Thx kai

DND Permission granted, but it's actually not (Android 13)

This is kind of an issue in the sense that it should be documented, but a workaround is available for now.
The application (mobile) says 'DND access granted', but it's actually not true on Android 13 (tested on a Pixel 6, 05-09-2022 security patch). This results in DND getting set from watch to phone, but not the other way around.

What you need to do, in order to actually grant the permission are the following steps:

  • Go to app info and then hit the three dot menu in the top right, then select the option to allow the app to access restricted settings.
  • Go to Apps -> Special access -> Notifications, and here turn on notification access to DNDSync

Once this is done, full duplex DND setting should be working again.

Pixel Watch minor change needed

This works great on the Pixel watch except for one bit. You're not currently able to modify the quick settings arrangement. So the middle first row is the flashlight. This means you're not able to trigger the bedtime mode which is first icon in the third row down.

Only working Phone to Watch with Zenfone 9 on Android 13 and GW4

I've just upgraded my Pixel 4 (running DND Sync perfectly) to a Zenfone 9 and have set it all up. GW is running One UI 5.0.
Aside from having to use adb pair now it all was fine. Everything works nicely from phone to watch, but the watch is not syncing back to the phone. I have enabled notification access for the app on the phone (which didn't have an option for restricted settings as noted in #7 )

[Feature Request] Bedtime mode sync

It would be great if this could also sync bedtime mode. On my Pixel 7 Pro enabling Bedtime mode triggers a notification from Digital Wellbeing with a title "Bedtime mode is on" and the category "Bedtime mode".

It's probably not a good idea to key this on a string due to internationalization, but we might be able to do it based on category.

Feature suggestion: Enable Bedtime on watch based on whether charging phone/when phone is in bedtime mode

On my phone, I have my (google) digital wellbeing app set to enable bedtime mode when plugging in between 23:00 and 7:00. So when I plugin my phone to a charger in that time, it goes into bedtime mode.

Now, I suggest to implement a feature to trigger bedtime mode on the watch, when the phone is plugged in and disable it when unplugged.

Tl,dr: Trigger bedtime mode on watch based on whether the phone is charging or not.

No Bedtime Sync - Pixel 6 Pro

I really miss this having come back to Pixel from Samsung wher eit worked 100% of the time

Since theres no "middle of the 1st row", and ive tried placing the quick tile everywhere on the first screen of them, im at a loss....

I miss my screen going grey!!!!!!!!

Trying to install on Ticwatch E3

I can't install it on my wife's Ticwatch E3, when I run the install command I get:

adb: failed to install dndsync_wear.apk: Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl587978859.tmp/base.apk (at Binary XML file line #7): Requires newer sdk version #30 (current version is #28)]

Is there any hope for a fix?

Here's some more info:

WearOS version: 2.34
System Version: H MR2
Android security patch level: October 5, 2021

Not working on GW4 and Pixel 4

I installed the phone app from the Play store (v1.4 Beta) and the watch app from releases here on Github because I couldn't find it on the play store. The watch is running OS 3.2 and the Pixel is on Android 12.

I granted permissions and enabled accessibility service etc, everything by the directions, however the sync won't work in either direction.

[BUG] DND on/off loop

There's a way to glitch DNDsync on watch/phone if you turn on/off DND fast on the phone that it keeps turning it back on and off until you disable DND sync for watch on the phone app.

DND home button activation

Hi, I been noticing that the DND and Bedtime get activated when I press multiple times the home button (Top Right bottom) when rejecting or muting a call.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.