binwiederhier / ntfy

Send push notifications to your phone or desktop using PUT/POST
https://ntfy.sh
Apache License 2.0
18.4k stars 725 forks source link

Android app: sometimes stops updating after a while. #826

Open YamatoRyou opened 1 year ago

YamatoRyou commented 1 year ago

:question: Question

Has self-hosted ntfy server and acts as a downstream push gateway for Synapse.

Device:

  1. Mi 9T (MIUI 12.5, based on Android 11, rooted)
  2. HMD Global TA-1054 (based on Android 8.1, rooted)

ntfy 1.16.0

It manifests as:

  1. Since the ntfy has taken over the Element push mechanism, Element Android cannot receive notifications and VoIP incoming calls;
  2. The ntfy app cannot receive pushes (even when sending messages from the web UI of the self-hosted server).

During the period when the push cannot be received, it has been confirmed that the ntfy application is still running in the background, and the network connection is in good condition. Without manually starting the application, it cannot be restored even if the network is disconnected and reconnected.

Currently known "temporary workarounds" are: a) Kill ntfy app and restart; b) Manually enter the ntfy application, manually refresh.

After a period of time (maybe 1~3 days) of "temporary solution" by the above method, the problem still persists.

The way I can think of is to execute the following command to simulate self-starting through some timing task mechanism without restarting the phone or manually opening ntfy.

adb shell
su
am startservice -n io.heckel.ntfy/io.heckel.ntfy.service.SubscriberService
am broadcast -a android.intent.action.BOOT_COMPLETED -p io.heckel.ntfy
wunter8 commented 1 year ago

That's strange. I haven't heard of anyone having issues like this before. Since you're obviously familiar with adb and stuff, have you tried using logcat to look at the ntfy logs for any signs of problems? You can also enable logging in the ntfy app itself. I don't remember if those logs are any different than logcat

YamatoRyou commented 1 year ago

That's strange. I haven't heard of anyone having issues like this before. Since you're obviously familiar with adb and stuff, have you tried using logcat to look at the ntfy logs for any signs of problems? You can also enable logging in the ntfy app itself. I don't remember if those logs are any different than logcat

My phone won't shut down except in special circumstances, in which case it takes a few days to reappear (possibly more than 3 days). Since no way to mitigate this problem has been found until recently, I decided to keep watching.

YamatoRyou commented 10 months ago

That's strange. I haven't heard of anyone having issues like this before. Since you're obviously familiar with adb and stuff, have you tried using logcat to look at the ntfy logs for any signs of problems? You can also enable logging in the ntfy app itself. I don't remember if those logs are any different than logcat

Log is here: {E46E8122-DF3A-2462-E709-4598BC67CD58}.zip Unzip password: {038283B5-6D87-E578-AB7E-2B65EAF08B66}

ChayseSmith commented 7 months ago

not sure if this is related or not, but I am experiencing almost the same thing.

I am not able to get the notifications to auto-populate through cloudflare tunnel no matter what I do. The only way I get the notification is if I open the app and drag from top to refresh. Closing the app then sending a notification when the app is closed doesn't work, re-opening the app doesn't work. Having the app open, and even the topic open doesn't work.

I was able to get it to work instantly when I was running on the local network and not through cloudflare tunnel.

I had to change the port number for NTFY to get my topic working through my cloudflare tunnel, not sure if that's related. However, I am getting instant notifications on the browser session regardless of using cloudflare URL or localhost on whichever port.

For testing, I subscribed twice on my android, once with local IP and once with cloudflare tunnel url. When I'm connected to the same router, I get an instant notification on my local topic, and don't get one at all on my cloudflare url topic (I suspect this is working as intended). When I am not connected to my network, I have to manually refresh to get the notification, which shows up in my cloudflare url topic and now the local topic doesn't get the notification (again, that part is probably working as intended).

Also for testing, I've opened my NTFY url in the browser on local machine, as well as on a second machine, and also on my android (in chrome). All of these solutions work instantly.

My android is a Samsung Galaxy Z fold 4 running Android 12. I am running Android app using ntfy v2.9.0 and latest app on play store. I'm running on a self-hosted server in a docker container, and I'm connecting to it through a cloudflare tunnel.

RoboMagus commented 6 months ago

I'm on a Galaxy S10 running into similar issues (probably). In my case I found that It's fine with getting instant notifications from my self hosted instance on the local network, but if I loose WiFi connection for a bit the app will just never reconnect. Refreshing works for getting the then pending notifications but the WS connection stays down. It seems that in my case changing the connection protocol to HTTP and back to WS again solves the issue. This could indicate an issue with the reconnection logic when switching between networks.