caffeinalab / ti.goosh

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

Recent crash report #109

Closed mark22 closed 5 years ago

mark22 commented 6 years ago

This thing has recently started dominating my crash logs (23,975 reports so far.... :)

Any ideas?

java.lang.RuntimeException: 
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3397)
  at android.app.ActivityThread.-wrap18 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1780)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6938)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException: 
  at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1538)
  at android.app.ContextImpl.startService (ContextImpl.java:1484)
  at android.content.ContextWrapper.startService (ContextWrapper.java:663)
  at android.content.ContextWrapper.startService (ContextWrapper.java:663)
  at android.support.v4.content.WakefulBroadcastReceiver.startWakefulService (WakefulBroadcastReceiver.java:99)
  at ti.goosh.BroadcastReceiver.onReceive (BroadcastReceiver.java:32)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3390)
mark22 commented 6 years ago

Line #6 at ti.goosh.BroadcastReceiver.onReceive (BroadcastReceiver.java:32) is bolded by Google Play BTW

mark22 commented 6 years ago

Ok I setup an Android 8.0 emulator and now I see this error about

Failed to post notification on channel "null" See log for more details

Which then led me to this change for Android 8.0: https://developer.android.com/guide/topics/ui/notifiers/notifications#ManageChannels

So it seems this error has to do with Notification channels.. No idea how to set those up, but just an FYI

killroyboy commented 6 years ago

I'm experiencing this issue as well. Have you determined the best way to handle this? Could ti.goosh somehow swallow this error? Or do we have to setup Channels?

mark22 commented 6 years ago

@killroyboy It sounds like you will have to setup channels. It looks like Ti.Goosh doesn't support that yet?

What I did for now is to downgrade the target SDK back to 25. It is when you go up above that in targetSDK that Android wants those channels.

Problem is Google says they will require target SDK above 25 starting in August, so you can target 25 and submit a build now and then just wait until Ti Goosh has an update to support channels

Thats my master plan atleast :)

killroyboy commented 6 years ago

@mark22 Thanks. I ended up doing the exact same thing. I'll figure out the channels after the current release.

davidbnk commented 6 years ago

Having the same problem, will downgrade target sdk to 25 Related: #97

adrienblot commented 6 years ago

This issue doesn't seem to be caused by channels.

Apparently, Android 8 reduced the scope of services and it is now forbidden to start a service in the background. You can reproduce the issue by stopping your app and sending a notification. You will get the same error: java.lang.IllegalStateException on startWakefulService. The GcmReceiver is now deprecated and the JobScheduler should be used instead for Android Oreo and above.

Downgrading the target SDK to 25 would be a solution, but Google Play will refuse it after the release of Android P (probably August 2018).

ShahrayarSoueid commented 5 years ago

java.lang.NumberFormatException: at java.lang.Integer.parseInt (Integer.java:521) at java.lang.Integer.parseInt (Integer.java:556) at com.google.gson.JsonPrimitive.getAsInt (JsonPrimitive.java:264) at ti.goosh.IntentService.parseNotification (IntentService.java:140) at ti.goosh.IntentService.onMessageReceived (IntentService.java:55) at com.google.android.gms.gcm.GcmListenerService.handleIntent (Unknown Source) at com.google.firebase.iid.zzc.run (Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) at java.lang.Thread.run (Thread.java:762)

this crash I got from android vitals and it's happening for all the users.

DFoxinator commented 5 years ago

Does anyone know a solution to this?

DFoxinator commented 5 years ago

I highly recommend using this plugin instead: https://github.com/hansemannn/titanium-firebase-cloud-messaging

No crashes and seems to work perfectly.