Skip to content

WhatsApp does not get GCM messages #75

Closed

Description

@michitux

As already mentioned in #52 there seem to be issues with apps not getting messages. I have had this issue today in a situation where microg definitely got a GCM message and had a stable connection before and after the message but WhatsApp did not receive the message until I opened it almost an hour later. Here the log with identifiers replaced by X/x (for uppercase/lowercase hex numbers) and # (for decimal numbers):

01-11 18:12:44.882 11243 11460 D GmsGcmMcsSvc: Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.micro[2410/6195]
csService (has extras) }
01-11 18:12:44.882 11243 11460 D GmsGcmMcsSvc: Scheduling heartbeat in 300 seconds...
01-11 18:12:44.882   443   553 E WifiNative-wlan0: doBoolean: disable
01-11 18:12:44.890 11243 20659 D GmsGcmMcsOutput: Outgoing message: HeartbeatPing{last_stream_id_received=146}
01-11 18:12:44.960   562   562 I wpa_supplicant: wlan0: CTRL-EVENT-SCAN-STARTED 
01-11 18:12:45.710   443   553 E WifiNative-wlan0: doBoolean: enable
01-11 18:12:45.733 20236 20236 D PrivacyPolice: Wi-Fi scan performed, results are: [...]
01-11 18:12:47.116 11243 20658 D GmsGcmMcsInput: Incoming message: HeartbeatAck{last_stream_id_received=146}
01-11 18:14:30.663 11243 20658 D GmsGcmMcsInput: Incoming message: DataMessageStanza{id=XXXXXXXX, from=###############, category=com.whatsapp, token=1, app_data=[AppData{key=ip, value=###.###.###.###}, AppData{key=id, value=XXXXXXXXXXXX}, AppData{key=ts, value=1452532470}], from_trusted_server=false, persistent_id=0:#############%xxxxxxxxxxxxx, sent=1452532470066}
01-11 18:14:30.710   443 12231 W ActivityManager: Unable to start service Intent { act=com.google.android.c2dm.intent.RECEIVE cat=[com.whatsapp] flg=0x10 pkg=com.whatsapp (has extras) } U=0: not found
01-11 18:15:00.999 20175 20175 D com.newsblur.service.ServiceScheduleReceiver: starting sync service
01-11 18:15:01.030 20175 23007 D com.newsblur.service.NBSyncService: Abandoning sync: app not active and network type not appropriate for background sync.
01-11 18:17:44.877   443   553 E WifiNative-wlan0: doBoolean: disable
01-11 18:17:44.877 11243 11460 D GmsGcmMcsSvc: Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
01-11 18:17:44.877 11243 11460 D GmsGcmMcsSvc: Scheduling heartbeat in 300 seconds...
01-11 18:17:44.877 11243 20659 D GmsGcmMcsOutput: Outgoing message: HeartbeatPing{last_stream_id_received=148}
01-11 18:17:44.963   562   562 I wpa_supplicant: wlan0: CTRL-EVENT-SCAN-STARTED 
01-11 18:17:45.713   443   553 E WifiNative-wlan0: doBoolean: enable
01-11 18:17:45.768 20236 20236 D PrivacyPolice: Wi-Fi scan performed, results are: [...]
01-11 18:17:47.033 11243 20658 D GmsGcmMcsInput: Incoming message: HeartbeatAck{last_stream_id_received=147

Note also the difference in the stream id. I wonder if microg should have sent an ack message? This difference in the stream id stays the same, i.e. there was always a difference of 1 until a reconnect happened because my phone got a WLAN connection.

Activity

  1. michitux commented on Jan 11, 2016

    @michitux
    ContributorAuthor

    I've just edited the log above, somehow in the log I had before the main error was missing:

    01-11 18:14:30.710   443 12231 W ActivityManager: Unable to start service Intent { act=com.google.android.c2dm.intent.RECEIVE cat=[com.whatsapp] flg=0x10 pkg=com.whatsapp (has extras) } U=0: not found
    

    aapt dump xmltree /data/app/com.whatsapp-1.apk AndroidManifest.xml gives me

          E: receiver (line=965)
            A: android:name(0x01010003)="com.whatsapp.gcm.GcmReceiver" (Raw: "com.whatsapp.gcm.GcmReceiver")
            A: android:permission(0x01010006)="com.google.android.c2dm.permission.SEND" (Raw: "com.google.android.c2dm.permission.SEND")
            A: android:exported(0x01010010)=(type 0x12)0xffffffff
            E: intent-filter (line=969)
              E: action (line=970)
                A: android:name(0x01010003)="com.google.android.c2dm.intent.RECEIVE" (Raw: "com.google.android.c2dm.intent.RECEIVE")
              E: action (line=971)
                A: android:name(0x01010003)="com.google.android.c2dm.intent.REGISTRATION" (Raw: "com.google.android.c2dm.intent.REGISTRATION")
              E: category (line=973)
                A: android:name(0x01010003)="com.whatsapp" (Raw: "com.whatsapp")
    

    In dumpsys package com.whatsapp I get under "grantedPermissions" com.whatsapp.permission.C2D_MESSAGE and com.google.android.c2dm.permission.RECEIVE and for com.google.android.gms I get com.google.android.c2dm.permission.SEND as granted permission.

    I would say this seems to be correct but I'm also relatively new to Android development so maybe I've missed something?

    [Edit] Added the probably more relevant information from the manifest of WhatsApp.

  2. pejakm commented on Jan 12, 2016

    @pejakm
    Contributor

    @michitux I can't confirm yet, but it seems to me that WhatsApp started to behave correctly after I installed this: https://github.com/microg/android_packages_apps_GsfProxy/releases

  3. pejakm commented on Jan 12, 2016

    @pejakm
    Contributor

    Actually, no this just happened to me a few moments ago.

  4. mar-v-in commented on Jan 12, 2016

    @mar-v-in
    Member

    What Android version is this?

  5. mar-v-in commented on Jan 12, 2016

    @mar-v-in
    Member

    I just added a flag that might fix this issue. Please check again with that commit included.

  6. michitux commented on Jan 12, 2016

    @michitux
    ContributorAuthor

    I've just tested this, it still doesn't work, the flag of the intent is now different though, so your change has definitely been applied:

    01-12 22:11:34.663   443   797 W ActivityManager: Unable to start service Intent { act=com.google.android.c2dm.intent.RECEIVE cat=[com.whatsapp] flg=0x30 pkg=com.whatsapp (has extras) } U=0: not found
    

    Signal is getting messages via GCM without any problems, there the log shows first an incoming message and then Signal says that it got a GCM message.

    This is on stock CM11 2015-12-13 on a Samsung Galaxy Nexus, patched using Needle. The self-check is green apart from the system's support for spoofing signatures. I have also re-installed WhatsApp yesterday even though it had already got the C2DM-permission during the last update. WhatsApp has version 2.12.402 (downloaded from its website).

  7. added a commit that references this issue on Feb 8, 2016
  8. Nutomic commented on Jul 17, 2016

    @Nutomic
    Contributor

    I'm using WhatsApp with GmsCore and don't have any problems. The only caveat is that I had to disable the Android 6 battery optimisation for GmsCore (in the system app settings). After that, messaging works fine.

    WhatsApp version: 2.16.155
    GmsCore version: 0.2.3-6-gbee7bc9 (from microg F-Droid repo)

  9. added 4 commits that reference this issue on Sep 27, 2016
    658ca5e
    b4ed171
    2d0f6ec
    87f400b
  10. added 2 commits that reference this issue on Nov 4, 2016
    33a2489
    f6c51d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions