Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes when receiving Push (FCM) #35

Closed
nuborian opened this issue Jan 9, 2017 · 1 comment
Closed

App crashes when receiving Push (FCM) #35

nuborian opened this issue Jan 9, 2017 · 1 comment

Comments

@nuborian
Copy link

nuborian commented Jan 9, 2017

Hi,

since FCM is "the future" I think we need a solution for this, so we can work with it :)

If i send a test notification over FCM my app crashes.

[ERROR] : TiApplication: (AsyncTask #3) [56387,57328] Sending event: exception on thread: AsyncTask #3 msg:java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.gson.JsonObject.has(java.lang.String)' on a null object reference; Titanium 6.0.1,2016/12/19 16:51,undefined [ERROR] : TiApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.gson.JsonObject.has(java.lang.String)' on a null object reference [ERROR] : TiApplication: at ti.goosh.IntentService.parseNotification(IntentService.java:122) [ERROR] : TiApplication: at ti.goosh.IntentService.onMessageReceived(IntentService.java:54) [ERROR] : TiApplication: at com.google.android.gms.gcm.GcmListenerService.zzq(Unknown Source) [ERROR] : TiApplication: at com.google.android.gms.gcm.GcmListenerService.zzp(Unknown Source) [ERROR] : TiApplication: at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source) [ERROR] : TiApplication: at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source) [ERROR] : TiApplication: at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source) [ERROR] : TiApplication: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) [ERROR] : TiApplication: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

Not sure how to set the "alert" object, since there is no such input on the fcm page. Just Keypairs. Any help would be great.

@progress44
Copy link
Contributor

Try a payload as in the example I just committed here 37c9ce7

The module expects a data property and all the other properties to be in it therefore if you don't set it the app crashes because it tries to read data as an object. Firebase supports the data property so as long as you use it this way it works. You can keep using the default Firebase properties such as title but they're not considered at all by the module.

ianko added a commit to ianko/ti.goosh that referenced this issue Jan 20, 2017
Fixes a crash that happens when you don't send a `data` object.

Stack trace: 
```
[INFO]  I/ti.goosh.IntentService: Not showing notification cause missing data.alert
[ERROR] AndroidRuntime: FATAL EXCEPTION: AsyncTask caffeinalab#5
[ERROR] AndroidRuntime: Process: com.fanhero.floridacup, PID: 32621
[ERROR] AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.gson.JsonObject.has(java.lang.String)' on a null object reference
[ERROR] AndroidRuntime:     at ti.goosh.IntentService.parseNotification(IntentService.java:122)
[ERROR] AndroidRuntime:     at ti.goosh.IntentService.onMessageReceived(IntentService.java:54)
[ERROR] AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService.zzq(Unknown Source)
[ERROR] AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService.zzp(Unknown Source)
[ERROR] AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source)
[ERROR] AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
[ERROR] AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
[ERROR] AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
[ERROR] AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
[ERROR] AndroidRuntime:     at java.lang.Thread.run(Thread.java:818)
```
progress44 added a commit that referenced this issue Jan 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants