microg / microg/GmsCore

Cloud messaging gets disconnected - never connects back

Open
#2,411 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
14.6k
Forks
3.2k
Avg merge
12d 11h
Merged PRs (30d)
4

Description

Affected app
Name: all using Google Cloud Messaging (GCM/CM)

Describe the bug
Cloud messaging gets disconnected and never connects back automatically.
The issue various WiFi nets, at home, hotels, etc. regardless if it goes out to internet directly or via a router piping traffic via a VPN provider. There's no consistency - it is something on the phone side.

It does not happen on data (tested in roaming) (default Automatic settings used). It is not consistent, it never works well on wifi (same on which it might be failing consistently.
There are situations that it works fine for quite some time on the same WiFi at home going out via VPN or directly (no app installed on the phone at all, just routing is set up that way). Checked connections table on the router - and connections seem to be present there. Whilst at first glance it might look like "oh, this is due to VPN", experience shows that it is not the case. Just mentioning it if it could provide additional light on situation.
Just right now, after fresh reboot, with battery below 15%, it just works fine for quite some time on this wifi going out via VPN. Earlier it was failing throughout the couple of days on both wifi, directly going out to internet same as via VPN.

The only way around is to set the ping to 60 seconds. Any other setting, including ping every 2 mins, gets it disconnected after some time (likely after that 60+ seconds. To re-connect, toggle needs to be pushed to disable CM and re-enable it again.

Checked connections at router level and seems like these are kept alive.

Feeling is that it has something to do with Samsung new approach to kill apps, even if all Self-check tick-boxes within MicroG are set/enabled.
Validated also in the phone/app settings for MicroG, that it is "Unrestricted".

Trying to set MicroG to "never put to sleep", identified that it is not listed on the Apps list, hence there's no way to add it to the list - this could be quick and easy workaround to the problem.

Reading at https://dontkillmyapp.com/samsung, seems like they kill apps, even if apps are set to be unrestricted.

From other experience, I've noticed that when phone is on the go, reconnecting between BTSes, apps are "reconnected"/kept alive and connection is more often kept alive for longer, that could be the reason why it stayed alive when on mobile data (even in roaming).

To Reproduce
Steps to reproduce the behavior:

  1. Just let the phone running and later go to MicroG -> Settings -> Cloud Messaging - check status.

Expected behavior
Cloud messaging to re-connect when loses connectivity automatically.

System
Android Version: 13
Samsung ROM
Kernel 5.15.78
One UI 5.1.1

microG
microG Core version: 0.3.2.240913
microG Self-Check results: All ticked

Similar issues (if not the same root cause):
https://github.com/microg/GmsCore/issues/1011
https://github.com/microg/GmsCore/issues/998
https://github.com/microg/GmsCore/issues/1810
https://github.com/microg/GmsCore/issues/1755

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in MicroG Settings > Cloud Messaging and compare this report with similar issues 1011, 998, 1810, and 1755. Reproduce on Android 13 with Samsung One UI 5.1.1 over Wi-Fi, then trace the cloud-messaging connection and reconnect behavior; done means the connection recovers automatically after it is lost without toggling the service.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.