-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Error and crash when receive a push in foreground #143
Comments
can you say what is null? Since that part is in a try/catch it should end up in |
No, i can't discover what is null.
|
If you can reproduce it please add a |
Maybe it's related to the "data" changes we merged recently? It would be interesting to know if an earlier version works. But yeah, the debug logs will help! |
could be but only if it is a data notification. But since |
Huum, i noted something: i was sending a Data notification, but it enter in the if of the message notification. |
what are you using to send the notification? And can you show the content? |
I'm using the firebase console to send the push.
|
And here the log of module on crash:
|
so like this ? I wonder if it is realted to: #137 (comment) since you have some other analytics data in your notification. |
I put a log before this line: https://github.com/hansemannn/titanium-firebase-cloud-messaging/blob/main/android/src/firebase/cloudmessaging/TiFirebaseMessagingService.java#L74 And send a push with data and one without data. The result: With data:
Without data:
Both entered in the if. I think we need verify if data is truly, because remoteMessage.getNotification() isn't null in both cases. |
The notification from Firebase is a mixed notification, so it has a notification block and a data part. So this is my Firebase console push:
and this is a data notification using PHP:
Both cases don't crash for me and all of them have the data node. |
I've found the issue 🤣 remove that 😉 [ERROR] TiExceptionHandler: (main) [3,108462] /alloy/controllers/index.js:290
[ERROR] TiExceptionHandler: Ti.API.debug("######### Got message: "+JSON.stringify(e)),
[ERROR] TiExceptionHandler: ^
[ERROR] TiExceptionHandler: Error: Attempt to get length of null array
[ERROR] TiExceptionHandler: at JSON.stringify (<anonymous>)
[ERROR] TiExceptionHandler: at CloudMessaging.onMessage (/alloy/controllers/index.js:290:45)
[ERROR] TiExceptionHandler: at CloudMessaging.value (ti:/kroll.js:1604:27)
[ERROR] TiExceptionHandler: at CloudMessaging.value (ti:/kroll.js:1656:25)
[ERROR] TiExceptionHandler:
[ERROR] TiExceptionHandler: ti.modules.titanium.android.notificationmanager.NotificationChannelProxy.getVibrationPattern(NotificationChannelProxy.java:225)
[ERROR] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[ERROR] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63)
[ERROR] TiExceptionHandler: org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:985)
[ERROR] TiExceptionHandler: org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1219)
[ERROR] TiExceptionHandler: android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] TiExceptionHandler: android.os.Looper.loopOnce(Looper.java:201)
[ERROR] TiExceptionHandler: android.os.Looper.loop(Looper.java:288)
[ERROR] TiExceptionHandler: android.app.ActivityThread.main(ActivityThread.java:7898)
[ERROR] TiExceptionHandler: java.lang.reflect.Method.invoke(Native Method)
[ERROR] V8Exception: Exception occurred at /alloy/controllers/index.js:290: Uncaught Error: Attempt to get length of null array |
OMG. |
But why didn't it show you that log but only the V8 part 🤔 |
And how i can get the data in a foreground notification? |
I use if (OS_ANDROID) {
console.log("Got message: " + JSON.stringify(e.message));
alert("Got message: " + JSON.stringify(e.message.data));
} else {
var data = JSON.parse(e.data || '');
console.log("Got message: " + JSON.stringify(data));
alert("Got message: " + JSON.stringify(data));
} in my test app |
It worked like a charm! |
Hi,
When i receive a push in foreground on android using the 3.3.1 released version (and with 3.3.1 version from m1g4 too #137) i receive an error:
I put some logs into it to get the exactly location of error and it occours on CloudMessagingModule.java inside onMessageReceived in this line: fireEvent("didReceiveMessage", data);
It's possible give a look on it? Thanks!
Using an Xiaomi Mi 9T with Android 10 to test.
SDK 11.0.0.GA
The text was updated successfully, but these errors were encountered: