caffeinalab / ti.goosh

GCM/FCM module for Titanium.
MIT License
52 stars 34 forks source link

java.lang.ClassCastException receiving foregrounded FCM ttl and sent_time #110

Open jkotchoff opened 6 years ago

jkotchoff commented 6 years ago

Env: Ti SDK 7.1.1.GA, Android 7.0. Tested with android module v4.1.0 and v4.1.1

Is the php FCM example on the module homepage working when an app is foregrounded? When I run it with the app backgrounded and sending to a single device token, the title and body of the notification is correctly received and shown in my Android system tray. When I run it with the app foregrounded, I receive the following stack trace:


[WARN]  Bundle: Key google.sent_time expected String but value was a java.lang.Long.  The default value <null> was returned.
[WARN]  Bundle: Attempt to cast generated internal exception:
[WARN]  Bundle: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
[WARN]  Bundle:     at android.os.BaseBundle.getString(BaseBundle.java:995)
[WARN]  Bundle:     at com.google.android.gms.gcm.zza.zzu(Unknown Source)
[WARN]  Bundle:     at com.google.android.gms.gcm.GcmListenerService.handleIntent(Unknown Source)
[WARN]  Bundle:     at com.google.firebase.iid.zzc.run(Unknown Source)
[WARN]  Bundle:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
[WARN]  Bundle:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
[WARN]  Bundle:     at java.lang.Thread.run(Thread.java:761)
[WARN]  Bundle: Key google.ttl expected String but value was a java.lang.Integer.  The default value <null> was returned.
[WARN]  Bundle: Attempt to cast generated internal exception:
[WARN]  Bundle: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
[WARN]  Bundle:     at android.os.BaseBundle.getString(BaseBundle.java:995)
[WARN]  Bundle:     at com.google.android.gms.gcm.zza.zzu(Unknown Source)
[WARN]  Bundle:     at com.google.android.gms.gcm.GcmListenerService.handleIntent(Unknown Source)
[WARN]  Bundle:     at com.google.firebase.iid.zzc.run(Unknown Source)
[WARN]  Bundle:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
[WARN]  Bundle:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
[WARN]  Bundle:     at java.lang.Thread.run(Thread.java:761)
[DEBUG] D/ti.goosh.IntentService: Push notification received from: 230344656513
[DEBUG] D/ti.goosh.IntentService: Notification key : google.sent_time => 1531022880351 (java.lang.Long)
[DEBUG] D/ti.goosh.IntentService: Notification key : google.ttl => 2419200 (java.lang.Integer)
[DEBUG] D/ti.goosh.IntentService: Notification key : google.message_id => 0:1531022880353590%0163e4800163e480 (java.lang.String)
[DEBUG] D/ti.goosh.IntentService: Notification key : notification => Bundle[{alert=This is a message sent from my http server, title=From server side}] (android.os.Bundle)
[DEBUG] D/ti.goosh.IntentService: Notification key : collapse_key => com.test.testapp (java.lang.String)
[WARN]  W/ti.goosh.IntentService: Show Notification: FALSE
[INFO]  Android onPushReceived
[INFO]  data received: {"inBackground":false,"data":"{\"c.i\": \"null\"}"}
[INFO]  data: "{\"c.i\": \"null\"}"
[WARN]  Could not process push notification```
nrpverma commented 5 years ago

@jkotchoff did u find anything? I'm also getting the same error.

jkotchoff commented 5 years ago

@jkotchoff did u find anything? I'm also getting the same error.

I gave up on this module due to the lack of response on this issue. I switched over to: titanium-firebase-cloud-messaging