microg / GmsCore

Free implementation of Play Services
https://microg.org
Apache License 2.0
8.38k stars 1.7k forks source link

GCM keeps disconnected from time to time #1522

Closed qtwrk closed 2 years ago

qtwrk commented 3 years ago

Describe the bug A clear and concise description of what the bug is.

GCM messages works , but it keeps shows "disconnected" after few hours , it will work again if I do ##2432546## trick , but after few hours, it will be back to "disconnected" status again

To Reproduce Steps to reproduce the behavior: no steps to reproduce it happens spontaneously

Expected behavior GCM keep connected all the time

System Android Version: 10 Custom ROM: Huawei EMUI 11.0.0

Additional context

Huawei Mate 40 Pro NOH-NX9 European variant.

hemker commented 3 years ago

Hey @qtwrk
I encountered a similar behaviour on a fresh Lineage 18.1 + MicroG installation on a OnePlus 6T. Every time I rebooted the device, or sometimes randomly, device registration turned off and thus push notifications did not work as expected. Fortunately, I found a solution on https://android-freaks.de/forum/thread/539-fix-push-probleme-mit-microg/

The trick is to add the following two lines

<boolean name="checkin_enable_service" value="true" />
<boolean name="gcm_enable_mcs_service" value="true" />

in the file /data/data/com.google.android.gms/shared_prefs/com.google.android.gms_preferences.xml. In my case, only the <boolean name="checkin_enable_service" value="true" /> was missing. After a reboot, I was immediately prompted to allow a bunch of apps to register for push notifications and now everything works as expected.

qtwrk commented 3 years ago

Hi, @hemker

Thanks for the info, but unfortunately that's not option for me as there is no way to root this device to get access to /data partition

I was actually looking for some kind of automated app that can be set to auto-dial that code every certain time :)

abda11ah commented 3 years ago

Are you sure that EMUI doesn't behave like FlymeOS ? In FlymeOS when you slide out MicroG of recent applications screen, the MicroG process is killed and the GCM service is automatically disconnected.

The only way to restart the MicroG process without making it appear in the recents applications screen is to restart the phone.

qtwrk commented 3 years ago

Hi @abda11ah

Yes, for that I am pretty much sure the MicroG was NOT killed because I frequently got notification like "microG is running for long time and consuming battery , consider to kill it " that kind of message

meanwhile , I also noticed something peculiar , it seems if I set phone into "do not disturb mode" , the GCM disconnects after certain time , however if I disable "do not disturb mode" , it seems keep connection alive for longer time (since yesterday morning till night , roughly 14 hours without disconnection )

ex-git commented 3 years ago

Try set the ping intervals for wifi and mobile to 2 mins and reboot. I am able to get push notification working after that. Tested on LOS with microG and Calyxos

qtwrk commented 3 years ago

Hi, @ex-git thanks , actually that's my current setting already :)

ale5000-git commented 2 years ago

Everything should already be fixed on the latest version so I close it for now. Open a new issue if needed.