mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #1035] LineageOS delays notification, despite io.heckel.ntfy.MESSAGE_RECEIVED intent being sent #728
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#728
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aerusso on GitHub (Feb 25, 2024).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1035
🐞 Describe the bug
Hello! I've been trying to dig into getting actually instant notifications, and right now the phone can take up to 180 seconds to make any indication that a message has been sent to it.
💻 Components impacted
This is up-to-date F-droid app, and up-to-date self-hosted server. This is a Moto x4 running up-to-date LineageOS. I originally thought those might have been implicated but the logs indicate otherwise:
💡 Screenshots and/or logs
I sent this message around 18:26:31, so the message intent broadcast is made less than 2 seconds after the actual send (which, by the way, is awesome!)
However, the phone didn't make any sound for a good 40 seconds after this! This is entirely reproducible, as long as the phone is not plugged in (i.e. charging) and not hasn't been recently interacted with.
🔮 Additional context
Is there some other mechanism in Android that delays the wake-and-make-sound step? I'm not even sure where to start looking/what to search for on the web. Is this a Lineage bug?
@aerusso commented on GitHub (Feb 25, 2024):
Ok, I'm trying to understand what is going on from the logs.
First of all, looking through the from-app captured log, i see a
Sending message intent broadcast:line, but no correspondingBroadcast received:line (?!?).Are those logs collated somewhere else? Where can I find those?
That said, from the
Displaying notification Notification(...)log entry, it seems that NotificationService.display is getting called, but is it completing? And moreover, is the subsequent call to NotificationManager.notify (from within displayInternal) getting the wakelock handed off to it (or held for it? I don't know the convention here).In short: I think that that
UserActionManageris being tasked to handle two kinds of work: tasks that should be handled once the phone wakes up (like sending network responses) and also things that need to be handled immediately (like sending notification to the user, passing off unifiedpush messages to other phone apps).Shouldn't those two kinds of tasks be handled separately? Both seem to be enqueued at the same time there?
@wunter8 commented on GitHub (Feb 25, 2024):
To address your first point (no corresponding broadcast received), I wouldn't expect ntfy to receive its own intent. I'm pretty sure (without digging into the code right now) that the message intent broadcast line corresponds to the setting in the Android app settings called "Broadcast Messages."
If you disable "Broadcast Messages", I would expect that line in the logs to go away. I believe the Broadcast Messages setting is only there for automation apps, like Tasker and MacroDroid, to react to received notifications. I'm pretty sure UnifiedPush continues to work (e.g., broadcast message intents to UP apps) in the background, even if that setting is disabled
@aerusso commented on GitHub (Feb 26, 2024):
Doesn't
BroadcastReceiverinBroadcastService.ktreceive the SEND_MESSAGE intent? The comment there at least suggests it does. But thank you for pointing out another thing it should be doing, and also explaining why it shouldn't be showing up! Anyway, it doesn't really matter.I am able to confirm that holding the wakelock for another few seconds causes the phone to respond to incoming messages nearly instantaneously. I've put this into a WIP patch.
@wunter8 I'd really appreciate your insight in that PR when you have time.