TMMARS-GCM onMessageReceived

时间:2016-04-18 08:04:08

标签: android google-cloud-messaging

我的应用程序崩溃,在GCM侦听器onMessageReceived上。我从Fabric-Crashlytics中解决了这个问题。我不知道该应用收到了什么。以下是Crashlytics的例外情况。

Fatal Exception: java.lang.NullPointerException at com.mjhram.ttaxidriver.gcm_client.MyGcmListenerService.onMessageReceived(MyGcmListenerService.java:51)
   at com.google.android.gms.gcm.GcmListenerService.zzt(Unknown Source)
   at com.google.android.gms.gcm.GcmListenerService.zzk(Unknown Source)
   at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
   at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
   at java.lang.Thread.run(Thread.java:856)

由于TMMARS(趋势科技MARS)服务引起了一些人的认定:

两者都引用问题,原因,但没有细节,或者他们如何解决问题。 以下是onMessageReceived:

public void onMessageReceived(String from, Bundle data) {
    String message = data.getString("message");
    Log.d(TAG, "From: " + from);
    Log.d(TAG, "Message: " + message);
        if (from.startsWith("/topics/")) {//crah here
            // message received from some topic.
        } else {
            sendNotification(message);
        }
}

在行[ if(from.startsWith(" / topics /"))]上引发异常。我不确定"来自"在这里传递为null!

任何人都可以帮我弄清楚发生了什么?我的apk收到了什么?

注意: 这种情况发生在Root设备上。

更新#1: Android Manifest中的接收器

<receiver
        android:name="com.google.android.gms.gcm.GcmReceiver"
        android:exported="true"
        android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

            <category android:name="com.mjhram.ttaxidriver" />
        </intent-filter>
    </receiver>

0 个答案:

没有答案