Gmscore: Delay in messages

Created on 5 Oct 2018  路  24Comments  路  Source: microg/GmsCore

Hello,

Most apps have trouble with push messages. I installed apps after installing microG. For example, I have to open whatsapp everytime to receive messages. I can't receive messages until I open the app. I have ignored battery optimisations for whatsapp and gmail and of course microG and gsf.

Some other apps crash at random times giving errors related to gms.

I just need whatsapp and gmail to work. Thank you!

鈽侊笍 Cloud / Push Messaging

Most helpful comment

Here's the simple workaround:
I turned off "Google Cloud Messaging > 3 dots > Advanced > Confirm new apps"
and all apps registered immediately.

Please link all people with GCM registration issues to this workaround.

Hence, the problem may be with the dialog not appearing when the app communicates to register with GCM.

I found that manually registering with GCM using *#*#2432546#*#* as suggested by @mar-v-in in #439 here was also necessary in order to get GCM / FCM working correctly.

All 24 comments

Please check the following:

  • you are using newest microg version 0.2.6-13280 running (ale5000 installer is updated and should be very helpful)
  • you deactivated battery optimization for microg
  • you activated google device registration
  • you get all the green checkmarks in microg diagnostics
  • you made sure nothing is blocking network traffic to mtalk.google.com (e.g. afwall, adaway, ...)
  • you deleted the app you have troubles with and installed it fresh after updating to microg 0.2.6-13280
  • you have not used backup solutions, like oandbackup, titaniumbackup, ... to restore app data
  • you can also use the push notification tester to check. I just tried it and it works.

To verify incoming messages, look in you logs and search for "GmsGcmMcsInput". You should see the heartbeat and Incoming messages. In the incoming messages there should be a category stating your apps package. This should be messages your receive via push.

Regarding checking the logs for GmsGcmMcsInput, you need to wait a few minutes after receiving or sending the last message. Otherwise an existing connection is used.

Yes, I personally waited for this build due to contacts issue.
Yes, deactivated
Yes, GCM is activated and connected.
Yes, all checkmarks are green.
Yes. Nothing is blocked.
Yes, did a fresh install without titanium backup either for app or data.
Yes, it may work but these apps didn't even ask for registration with GCM. Only youtube asked for it.

How to check logs?

e.g. via apps like catlog or via adb. Possibly can find that as well in the filesystem, but have never done that.

You should also check to have all google related stuff deinstalled and only try push notification tester or whatsapp. Not that some google app pulled google framework or parts of it.

Same issue. Until I open whatsapp, messages don't arrive. When I use whatsapp web, I have to unlock my phone every minute and open whatsapp to receive messages. :(

To go further, we need to see logs, best during registration and during message receive.
I am using whatsapp myself and it is working.

Weird is, that you ignored battery optimization for whatsapp as well and still have a delay. If Whatsapp would work in pull mode (and ignore GCM), it would then be on time.

How to make whatsapp ignore it then?

Whatsapp will always try GCM first and only fallback to pull mode, if GCM fails. Hence the logs during registration and message retrival are important, to see what if something is going wrong.

Here's the log. I started recording, opened whatsapp and received messages.
https://drive.google.com/open?id=16dTYXbH3YbaepQYKqY4nkIDMZgfVBnIG

Hope it helps.

This seems to me, like Whatsapp is doing polling and not GCM. With GCM you would see messages with "GmsGcmMcsInput". Your logging is all from Whatsapp App.
Do you have a log during registration?

Whatsapp never asked me to register with GCM.

No, it does not. You need a record when installing it and confirming your mobile number.

Hey!
I got a whatsapp crash today and it helped me fix the problem with all apps that had a delay or couldn't register with GCM. This may help all people who have trouble getting apps to register with GCM.

java.lang.RuntimeException: Unable to create service com.whatsapp.gcm.RegistrationIntentService: java.lang.RuntimeException: Unable to instantiate application com.whatsapp.AppShell: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2887)
    at android.app.ActivityThread.-wrap4(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1427)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
Caused by: java.lang.RuntimeException: Unable to instantiate application com.whatsapp.AppShell: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at android.app.LoadedApk.makeApplication(LoadedApk.java:578)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2874)
    ... 9 more
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.facebook.b.a.a.a.c.createDelegate(:24928)
    at com.facebook.b.a.a.a.c.ensureDelegate(:24930)
    at com.facebook.b.a.a.a.c.attachBaseContext(:24903)
    at android.app.Application.attach(Application.java:187)
    at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
    at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:360)
    at android.app.Application.attach(<Xposed>)
    at android.app.Instrumentation.newApplication(Instrumentation.java:997)
    at android.app.Instrumentation.newApplication(Instrumentation.java:981)
    at android.app.LoadedApk.makeApplication(LoadedApk.java:573)
    ... 10 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at com.facebook.b.a.a.a.c.createDelegate(:24927)
    ... 19 more
Caused by: java.lang.IllegalStateException: log application context already assigned
    at com.whatsapp.util.Log.a(:116666)
    at com.whatsapp.App.<init>(:188159)
    ... 21 more

Here's the simple workaround:
I turned off "Google Cloud Messaging > 3 dots > Advanced > Confirm new apps"
and all apps registered immediately.

Please link all people with GCM registration issues to this workaround.

Hence, the problem may be with the dialog not appearing when the app communicates to register with GCM.

All apps registered immediately?
is that one

Install the patch Register on Wechat can push gcm
But Start app on push message doesn't work. Wechat won't start.
I have to start with other apps

try
Close the FakeGApps patch
Close Confirm new apps
Restart Self-Check by reducing
Still can be pushed by gcm

Don't disable FakeGapps. It is needed for microG.

Here's the simple workaround:
I turned off "Google Cloud Messaging > 3 dots > Advanced > Confirm new apps"
and all apps registered immediately.

Please link all people with GCM registration issues to this workaround.

Hence, the problem may be with the dialog not appearing when the app communicates to register with GCM.

I found that manually registering with GCM using *#*#2432546#*#* as suggested by @mar-v-in in #439 here was also necessary in order to get GCM / FCM working correctly.

Here's the simple workaround:
I turned off "Google Cloud Messaging > 3 dots > Advanced > Confirm new apps"
and all apps registered immediately.

Where do I find that option / that setting? I can't find it either on a LOS 14.1 device nor on a device running LOS 15.1.

3 dots = Top right corner when viewing the Google Cloud Messaging.

Also might try closing all apps, then enabling Confirm New Apps option , installing the Navy Federal Credit Union banking app, after it registers and requests confirmation, disable Confirm New Apps and open them one at a time.

Procing it worked for me, and after that all my apps registered as soon as I opened them.

Hope this helped.

Problem is: I can't even find "Google Cloud Messaging" in LOS settings. :(

It's in the microG app

That explains why I can't find it: I installed OpenGAPPS Pico. Although I am experiencing the same ugly delays of messages, I am totally at the wrong place to look for a cure. Sorry!

The problem should be fixed in the new version of microG GmsCore released yesterday, I'm closing this for now.
Please try it and report back.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mar-v-in picture mar-v-in  路  3Comments

jonathanamorford picture jonathanamorford  路  5Comments

ghost picture ghost  路  4Comments

ale5000-git picture ale5000-git  路  4Comments

Riamse picture Riamse  路  5Comments