httpdispatch / MissedNotificationsReminder

Periodical sound reminder for missed notifications in Android OS.
74 stars 22 forks source link

overrides Do not disturb #21

Closed scaprile closed 6 years ago

scaprile commented 6 years ago

Hi, al least on a J320M running 5.1.1, when the phone is in do not disturb mode, notifications will still be reminded, which is not really wanted. Workaround is to set the custom scheduler so the reminder is off at the time when do not disturb is on, but this requires maintaning to schedules for the same stuff, and gets easily broken if the user manually sets the phone in do not disturb (he/she should also disable the reminder, and remember to enable it back later). I can help if properly guided. Regards.

httpdispatch commented 6 years ago

Hello, what kind of DND do you use custom (when some apps are allowed) or full?

scaprile commented 6 years ago

Hi, my notifications do not pass through, they do not sound nor vibrate. Reminders do. My DnD has alarms and calls permitted. Whatsapp and Telegram, for example, have notifications permitted (not blocked) and they are not set as priority. When I get a message on one of these apps during DnD hours, the notification is shown on the top bar, but the phone does not sound nor vibrate, as expected. Then, after some time, the reminder (OS's own or this app) starts buzzing. On newer OSs there is the option to block reminders of certain apps under DnD options; on 5.1.1 (or at least on this phone), one can only block notifications (always, DnD or not) or set as priority (to override DnD, which I don't). As said, the system reminder (Settings->Accesibility->Notification reminder) also overrides DnD, that is why I disabled it and searched for a solution and came across this app, which btw works the same. I'm technically literate enough so if you want to gather some data just lead me on or (preferably) point me to some logging utility. Regards.

httpdispatch commented 6 years ago

Looks like i need to add additional ZenMode check to the app https://gist.github.com/noln/0ba4c085c8b292e56577 May i ask you to test it once i will be implemented? Not yet sure when it will be done.

scaprile commented 6 years ago

Of course!

httpdispatch commented 6 years ago

@scaprile i've released a new version which contains the possible fix. Can you please try it?

scaprile commented 6 years ago

Well, I updated the app in my phone and my tablet, both Samsung, Android 5 and 7 respectively. No reminding at all, no matter if DND is on or off. I disabled DND completely and there is still no reminding.

httpdispatch commented 6 years ago

@scaprile Found a bug. Today will release a fix. Can you please re-test once it will become available?

scaprile commented 6 years ago

Sure, no problem. During the DoNotDisturb hours, a message came in and it started reminding, Perhaps your check was inverted ? As it does when entering the scheduled time, pre-existing notifications should be reminded. E,g,: my scheduled remind time is from 9am to 10pm, if a message comes in at 8am nothing happens, but then at 9am it starts reminding. The same should occur if instead of using the scheduled time I set DND from 10pm to 9am. I toyed a bit yesterday changing DND settings with notifications present and didn't see that. Will check again when the app updates. If you want to attach an apk instead of rolling updates, or do some logging, I can handle that.

scaprile commented 6 years ago

Now we're closer. Notifications received when in DND are not reminded; while those in "normal" mode are. The problem is with transitions, as explained in the former post. Furthermore, if there is a notification being reminded before entering DND, it will keep reminding. I think it shouldn't. (And also, as explained before, if there is a notification that has been issued during DND and therefore not been reminded, it won't be reminded when exiting DND. I think it should)

httpdispatch commented 6 years ago

@scaprile looks like DND mode changed notification doesn't work on your device, that is why you experiencing this behaviour. Can you please install debug version of the app (installs separately), set it up and activate deactivate DND mode few times? Then please share a log

Instructions how to share the log https://github.com/httpdispatch/MissedNotificationsReminder/issues/1#issuecomment-160621802

Debug version of the app https://drive.google.com/file/d/0B4hn2M3Klm4MdDN2OER1VWMxUWs/view?usp=sharing

scaprile commented 6 years ago

2018-01-12T00_17_04.47.zip Tried to mimic DNDoff -> notification -> DNDon notification -> DND off Could not install in Android 7 device, this is Android 5.1.1; Samsun J320M. Both behave in the same way anyway.

httpdispatch commented 6 years ago

@scaprile From the log i can see that on app initialization DND mode has been turned on, then it has been changed to some other value but still turned on

scaprile commented 6 years ago

That seems to be part of the problem. DND can be set to "turn on as scheduled" and "turn on now", there's two sliders I left the 'scheduled' on and toyed with the 'now'. I was inside the scheduled time. This log is: no DND at all notification DND scheduled, but off now and not in scheduled hours notification DND on now (a popup is displayed saying it will be turned off at scheduled time) notification back to scheduled back to no DND at all DND on now notification back to off 2018-01-12T11_23_14.448.zip

httpdispatch commented 6 years ago

I've prepared new debug version which logs actual zen_mode value. Can you please update app and do the same actions as desccribed in your last message?

https://drive.google.com/file/d/0B4hn2M3Klm4MdDN2OER1VWMxUWs/view?usp=sharing

scaprile commented 6 years ago

No problem. 2018-01-15T10_25_16.14.zip

httpdispatch commented 6 years ago

Thanks.

In the log i see. Is everthing correct?

DND OFF
10:18:46.945 ReminderNotificationLis D zenModeUpdated: 0

Multiple notifications posted

10:21:26.869 ReminderNotificationLis D onNotificationPosted() called with: packageName = com.xabber.android

DND changed notification but still DND is OFF
10:21:27.005 ReminderNotificationLis D zenModeUpdated: 0

Reminder stopped because xabber notification is removed
10:21:44.619 AbstractReminderNotific D onNotificationRemoved: for package com.xabber.android

Few more DND changed notifications but still DND is OFF

New notifications are posted
10:23:37.765 ReminderNotificationLis D onNotificationPosted() called with: packageName = com.xabber.android

Reminder scheduled
10:23:37.811 ReminderNotificationLis D scheduleNextWakup: Schedule reminder for 60 seconds

DND turned ON almost immediatedly
10:23:37.841 ReminderNotificationLis D zenModeUpdated: 1

Canceling reminder
10:23:37.861 ReminderNotificationLis D stopWaking: cancel reminder
scaprile commented 6 years ago

I don't know what you mean by "correct"... I did exacrly as described. "notification" means: I sent a msg to one of my chat accounts so Xabber can get it. Then I pressed on the notification to enter Xabber, and got out. Your app was set to catch Telegram and Xabber, and Telegram was idle at that time Then, I recalled the settings screen, changed the setting, and left the phone after putting the screen off. The whole process took a couple minutes.

I noticed that ZenMode is almost always 0, didn't check the log in deep because I mostly don'y know what to see. I can do it again and wait some time between changes.

scaprile commented 6 years ago

no DND at all notification, sound reminder reminds I remove notification DND scheduled, but off now and not in scheduled hours notification, sound reminder reminds I remove notification DND on now (a popup is displayed saying it will be turned off at scheduled time) notification, no sound let some time elapse, no reminders: correct I remove notification back to scheduled back to no DND at all (this change is done all at once, moving both sliders in one access to the settings screen) notification, sound *DND was off, but there was no reminder. I heard the incoming sound. I double checked: the phone was not indicating DND so it was really off let some time elapse, no reminders send another notification, sound let some time elapse, still no reminders I remove notification and toyed with the phone a bit, changed brightness and locked again send another notification, sound let some time elapse, bingo! Now I get a reminder! Let's blame it on Samsung this time... let it remind twice (just in case...) I remove notification DND on now (no scheduled) notification, no sound let some time elapse, no reminders: correct I remove notification back to scheduled, off now. 2018-01-16T11_04_01.031.zip

scaprile commented 6 years ago

Then I sent another notification... DND was off but scheduled and it did not remind. I toyed with the phone again and this time I noticed that when I've set the screen to "outdoors", your app's notification telling the reminder was active just popped in. And it started to remind... Mmmm... either Samsung's fault or you don't get changes in due time because you didn't register for it... Whatever. This happened between 11:05 and 11:11 approximately, when there is a reminder. Anyway, I wanted to toy with transitions so 11:14 I set the phone to go DND 11:18 and leave it on until 11:30 (just in case, I toyed with "outdoor" mode...) I then sent a notification and let it remind. It did for a while. Around 11:18:something I heard an interrupted chime (may be DND transitioned just when starting to remind?), and no further reminders. Cool! (Times are in my computers, it might differ to the phone but not more than 1min) 11:21 I sent another notification, no sound, and no reminder, 11:23, Just in case, I removed both and sent a new one 11:30 the phone went out of DND as scheduled no reminders 11:32 I checked by turning the screen on: DND was off, indeed, and there was a pending notification from Xabber as expected, but no reminder. 11:34 I toyed with the settings, setting outdoors mode again. The "reminder is active" notification popped in, so I removed both. I think this whole issue is because sometimes you don't get notified of when DND goes off (perhaps on too). 2018-01-16T11_36_49.703.zip

httpdispatch commented 6 years ago

@scaprile Looks like app doesn't receive DND mode updated events properly

Here it has been received (how i understand without your interaction) 11:18:47.944 ReminderNotificationLis D DND mode changed to true

This is what happened at 11:30 11:30:00.332 AbstractReminderNotific D onNotificationRemoved: for package com.android.systemui 11:30:00.333 ReminderNotificationLis D onNotificationRemoved but no DND mode changed events

Only at 11:34 such event has been received 11:34:31.605 ReminderNotificationLis D DND mode changed to false

Actually i don't know what else i can do to fix this behaviour.

httpdispatch commented 6 years ago

I've tested the scheduler on my phone and it works as expected.

scaprile commented 6 years ago

OK, I haven't developed for Android for a long time, so I can't comment. I'm OK with the app scheduler, I just set it to the same time as the phone schedule. Knowing this erratic behaviour, I can check the phone when I'm coming out of DND mode ;^) Thanks for trying. If I can be of any help, count on me.