【问题标题】:Android Gcm onMessage().. Recived "null" on some devices why?Android Gcm onMessage().. 在某些设备上收到“null”为什么?
【发布时间】:2016-05-10 12:56:18
【问题描述】:

Android Gcm onMessage().. 在某些设备上收到“null”,例如“Android 4.4 LG GPad 1.0”和“Android 6.0 Lg G4”.. 但在某些设备中,Gcm 会收到正确的消息,例如“Android 5.1 Samsung J5 and J2”...... 我无法解决的问题是什么...... 这是代码...

 protected void onMessage(Context context, Intent intent) {
    Log.i(TAG, "Received message");
    //Bundle extras = intent.getExtras();
    String message = intent.getExtras().getString("message");



 <receiver
        android:exported="true"
        android:name="com.google.android.gcm.GCMBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <!-- Receives the actual messages. -->
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <!-- Receives the registration id. -->
            <action droid:name="com.google.android.c2dm.intent.REGISTRATION"/>
            <category android:name="com.xtravoapps.premierdocfinder" />
        </intent-filter>
    </receiver>
    <service android:name="MYPACKAGENAME.GCMIntentService" />

【问题讨论】:

  • 你到底想达到什么目的?
  • 我想在所有 android 移动设备上看到我的 gcm 通知.....但是通知接收到一些设备......而一些设备接收到“null”......为什么
  • 发布更多代码 sn-ps。您的完整接收者、完整清单、您发送的有效负载。如果我们能看到这些将会很有帮助。 :) 干杯!

标签: android push-notification google-cloud-messaging android-notifications


【解决方案1】:

我们在多个 Android 设备版本 6.0.1、5.0.1 和 4.4.4 的推送通知中收到空消息。在不更改 Android 应用或服务器应用的情况下,一些设备会变为空,而许多其他设备会得到正确的消息,但越来越多的设备会变为空。

根据我们的测试,收到空推送通知消息的 Android 设备(手机、平板电脑)是 Google Play Services 版本 9.4.52 的设备。其他具有早期版本 Google Play 服务的设备在自动更新到 9.4.52 之前都可以正常工作。

我们将几个收到 null 的设备从 9.4.52 降级回早期版本。降级后,我们向这些设备发送推送通知,它们正确接收消息并修复了空消息问题。

要求我们的 Android 用户为我们的应用通知降级播放服务可能不切实际,因此请努力查看是否有任何更改可以通过 Play Services 9.4.52 缓解此问题。

希望这有助于回答“GCM 为什么在某些设备上接收 null”这个问题。

【讨论】:

    【解决方案2】:

    可能是因为googlePlay服务没有更新

    【讨论】:

      猜你喜欢
      • 2013-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-14
      • 1970-01-01
      • 2018-02-20
      相关资源
      最近更新 更多