signalapp / Signal-Android

A private messenger for Android.
https://signal.org
GNU Affero General Public License v3.0
25.53k stars 6.12k forks source link

Messages not delivered when app is in background #10947

Closed zskamljic closed 2 years ago

zskamljic commented 3 years ago

Bug description

On Huawei P30 messages do not seem to be received unless the screen is unlocked and notifications are not shown. On sender device for the most part only one checkmark appears (sent, but not delivered), other times both appear, but the device still does not receive messages. All messages arrive if phone screen is unlocked or if the app is open.

Note that notifications from other apps (including a sample app that uses firebase notifications I made) work fine.

I have followed the troubleshooting on these links: https://support.signal.org/hc/en-us/articles/360027913252-Troubleshoot-receiving-messages#android https://support.signal.org/hc/en-us/articles/360028198711#huawei - only the first one exists, the remaining points don't seem to be present on the device https://support.signal.org/hc/en-us/articles/360027919052

Manual management is enabled for Signal, and it's allowed to Auto-launch and Run in background

Steps to reproduce

Actual result: Describe here what happens after you run the steps above (i.e. the buggy behaviour) Expected result: Describe here what should happen after you run the steps above (i.e. what would be the correct behaviour)

Screenshots

In Settings > Battery > App launch image

Device info

Device: Huawei P30 Android version: 10.0 Signal version: 5.3.12

Link to debug log

https://debuglogs.org/f4c00c1cdffc8e91f01fe64f5aecc23d63b2f6e7a93daa2f5528f5f4e3856254

Parstion commented 3 years ago

Have you tried disable battery optimization? it is in Settings -> Apps -> Apps -> 3 dots -> Special access -> Battery optimization -> Select All apps and search for Signal -> Select ( Don't allow ) by the way these on EMUI 10, don't know about the others

zskamljic commented 3 years ago

Changed this setting as well, but it seems to be the same

Nisc3d commented 3 years ago

First: You posted your issue at the right place and it should still stay here. I'm just informing on another way you could help solve issues around missing notifications. Right now a Signal Developer asked on the forum to send additional debug information directly to him via a direct Message on the Signal Forum. This includes a Android Bug report, which contain more information, that could help. If you are comfortable sharing that information you can register at the forum. Here are the detailed steps what to send and some more information what is included in an Android Bug report (read carefully): https://community.signalusers.org/t/help-needed-share-an-android-bug-report-to-help-debug-notifications/27739

AsamK commented 3 years ago

Looking at the logs, it seems the Signal app receives the firebase notifications without much delay. But fails to connect to the signal servers to get the actual message. Is there maybe some background data saver active on the device, that limits network access when the screen is locked?

[5.3.12] [20036] 2021-02-10 11:37:47.733 CET I FcmReceiveService: onMessageReceived() ID: 0:1612953467240888%e3016397f9fd7ecd, Delay: 494, Original Priority: 1
[5.3.12] [main ] 2021-02-10 11:37:47.740 CET I FcmFetchService: Incrementing active count to 1
[5.3.12] [20032] 2021-02-10 11:37:47.746 CET W BackgroundMessageRetrie: We may be operating in a constrained environment. Doze: false Network: false
[5.3.12] [20032] 2021-02-10 11:37:47.747 CET I BackgroundMessageRetrie: Performing normal message fetch.
[5.3.12] [20032] 2021-02-10 11:37:47.747 CET I BackgroundMessageRetrie: Attempting strategy: RestStrategy (1 ms elapsed)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy: Failed to retrieve messages. Resetting the SignalServiceMessageReceiver.
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy: org.whispersystems.signalservice.api.push.exceptions.PushNetworkException: java.net.ConnectException: Failed to connect to textsecure-service.whispersystems.org/13.248.212.111:443
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    at org.whispersystems.signalservice.internal.push.PushServiceSocket.getServiceConnection(PushServiceSocket.java:1486)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeServiceRequest(PushServiceSocket.java:1411)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    at org.whispersystems.signalservice.internal.push.PushServiceSocket.getMessages(PushServiceSocket.java:422)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    at org.whispersystems.signalservice.api.SignalServiceMessageReceiver.retrieveMessages(SignalServiceMessageReceiver.java:272)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    at org.thoughtcrime.securesms.messages.RestStrategy.enqueuePushDecryptJobs(RestStrategy.java:85)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    at org.thoughtcrime.securesms.messages.RestStrategy.execute(RestStrategy.java:39)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    at org.thoughtcrime.securesms.messages.BackgroundMessageRetriever.executeBackgroundRetrieval(BackgroundMessageRetriever.java:87)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    at org.thoughtcrime.securesms.messages.BackgroundMessageRetriever.retrieveMessages(BackgroundMessageRetriever.java:67)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    at org.thoughtcrime.securesms.gcm.FcmFetchService.retrieveMessages(FcmFetchService.java:85)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    at org.thoughtcrime.securesms.gcm.FcmFetchService.fetch(FcmFetchService.java:75)
...
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy: Caused by: java.net.ConnectException: Failed to connect to textsecure-service.whispersystems.org/13.248.212.111:443
...
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy: Caused by: java.net.ConnectException: failed to connect to textsecure-service.whispersystems.org/13.248.212.111 (port 443) from /100.81.155.134 (port 59464) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused)
...
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy: Caused by: android.system.ErrnoException: isConnected failed: ECONNREFUSED (Connection refused)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    at libcore.io.IoBridge.isConnected(IoBridge.java:275)
[5.3.12] [20032] 2021-02-10 11:37:49.843 CET W RestStrategy:    ... 54 more
zskamljic commented 3 years ago

No data savers there, everything that I could find that was related to either data saving or power saving has been disabled, with no changes. Perhaps noteworthy, other apps seem to be getting notifications correctly.

Vrumfondel commented 3 years ago

Hi there! Got the same issue on my Unihertz Titan with Android 10. No messages are received if Signal is in Background. All the "normal" countermeasures regarding batterysafe and backgrounddata are allready set as they should be - but no success ...

theo2354 commented 3 years ago

Hello,

Same problem with a Ulefone Armor 5, no battery nor network limiter, notifications only arrive if the app is opened.

Vrumfondel commented 3 years ago

Hello again,

the main issue seems to be that correlated settings are somehow spread within Android10 in several locations - which are not even obviously named. I wonder why Apps line WhatsApp are able to set these correctly on installation, but Signal can't. Can you check if your phone has a setting like the following (My Phone is German, so please be aware that my translation might not be 100% percise): Settings -> intelligent help -> app limitations -> Signal -> all switches must be set to OFF .

anwfr commented 3 years ago

Same problem here with Unihertz Titan on Android 10. @Vrumfondel Can't find "intelligent help" or "app limitations" in my settings menu, could you post a screenshot plz?

Vrumfondel commented 3 years ago

OK, maybe this is a translation issue. On the Titan, if you go to the settings, the 4th option from top - beeing a yellow hand - is called "intelligente Hilfe" in the German version. Under this, the 5th item from top is "App-Beschränkungen". Changing this made Signal finally work as expected for me.

mkauzlar commented 3 years ago

Same thing on Ulefone Armor 7 (Android 9). After a while the notifications stop and they resume only if the app is started in the foreground. This problem is all over the web, reported by many people. I advise changing the title by removing "on Huawei P30" since it's not Huawei related and will increase visibility for people searching this issue.

Tsjippy commented 3 years ago

I have te same problem on a Infinix phone. All settings I could find are set correctly. But messages are only shown if I open the signal app.

mkauzlar commented 3 years ago

8597

8105

10192

9697

9638

9368

9339

9225

8881

8302

Clearly the notifications in background are broken, somebody ought to investigate and fix this

anwfr commented 3 years ago

@Vrumfondel Excellent, thank you so much! Found it under: Settings > Smart Assistant > App blocker > Signal > uncheck all restrictions

zskamljic commented 3 years ago

Issue seems to have gotten worse with the latest Huawei update, now it appears that the app needs to be open to actually get the message. I'm aware that this is a Huawei issue, but it's probably forcing a lot of people to abandon the app, myself included.

jedie commented 3 years ago

There is also a forum threads about this Problem. Mainly: https://community.signalusers.org/t/help-needed-share-an-android-bug-report-to-help-debug-notifications/27739

ZiOLONwe commented 3 years ago

I have the same problem, I try very solution. No work.

ghost commented 3 years ago

I'm aware that this is a Huawei issue

It's not. 50% of my contacts don't receive my messages because of this. I always have to write them via Whatsapp that they should open Signal and most of them don't have Huawei phones...

janvlug commented 3 years ago

I have one particular contact with a Huawei pro 30 who is experiencing severe issues with receiving notifications as well.

ConstantMan commented 3 years ago

I have the same problem with signal on Android 8, I have heavily degoogled my phone and I use netguard to disable any internet access. So I have noticed that signal notifications work only when I enable Google services, is there any way to install signal from a different source other than Aurora in order to receive notifications without the Google services?

suamor commented 3 years ago

I have this problem with multiple apps. Apps like signal, whatsapp, telegram. Some of them are working fine, others do not work at all, some notifications are working, others do not work at all. Sometimes notifications do not come. As if the app is suspended even though no battery optimization is happening. I have a Samsung A41. This problem is also present in older Android versions. Though in Android 11 it is occuring much more often.

  1. Voice/Video call: No notification when phone is locked. Sometimes call notification when phone is unlocked. No missed call notification from such apps.
  2. Messages: Sometimes notifications when phone is locked. When phone is unlocked notification work when app has been running recently. But they stop coming in all situations when app has not run for a longer time.

I think that some internal changes on Android 11 notification system has especially worsened situations with call notifications. As there is no solution in sight I will stop using Android 11 (buying new phone with Android 10, downgrading or something else) until this is solved.

UserX404 commented 3 years ago

@suamor Without a log nobody can help you. Please try 'DontKillMyApp' from playstore for analysis. It's likely your device/os is killing the needed backgroundtasks.

@KonstantMan https://signal.org/android/apk/ Universal build with integrated self-updater

kpeace commented 2 years ago

This helped me:

Apps & Notifications -> All Apps -> Signal -> Notifications -> Lock Status - > Make sure it's on "Alerting"

greatanotherusername commented 2 years ago

EDIT: Solved it! "Data Saver" was enabled, blocking sending and receiving data in the background. I must have done this as a blanket setting when going through the privacy settings quagmire described below. I went into Network and InternetData SaverUnrestricted data and enabled Signal, Telegram, and my email app (all of which had this problem it turns out), and now calls get through okay on the lock screen. You can tell you have this setting turned on if you see a little circle with one-third of its border greyed out and a little plus sign inside up on your status bar.

image


Android 12, Pixel 5, all updates. Long-press "missed call notification", select "default" (not "silent"), click "Manage" and tick all the appropriate things there, then from the same menu go into the Apps submenu and set all the Signal settings to what's logical (can't remember the details now, there's just too much I've been doing today trying to make this work and it's all mush now in my head).

Calls will vibrate/ring once on lockscreen if Signal is open under it, and will not if Signal has been killed. Sometimes it works if Signal is open but in the background, sometimes not (doesn't seem to matter if Signal's the "first" background app or if others are in the background but "in front of it", in that they were more recently opened). Possibly due to running for a longer time versus a shorter one, or more recently being focused versus being in the background for longer; not sure.

<rant>

Wading through the permissions and privacy settings was a nightmare though. Took me a whole afternoon, between hacking on the phone and reading fora. First you have the phone settings, then you have the in-app Signal settings (both of these bounce you back and forth to each other on top of that, until you forget in which set of settings you are), and then these almost hidden settings that are only accessible through the fluke of discovering that long-pressing works on missed call notifications, and even then diving in like three menus deep.

I'm sure there will be a day when Signal will ring just like a regular call, displaying as such on the lockscreen and inside the unlocked device, no matter if the app has been killed or is running in the background or any other configuration (currently notifications work well when you're actively in the app, running it in the foreground, so that's at least good). I really look forward to that day. Because this is the go-to for privacy, just not reliability or ease-of-use right now, unfortunately.

</rant>

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.