A certain model of device cannot parse the payload of the data message.
See original GitHub issue- Android Studio version: 4.1.3
- Firebase Component: Cloud Messaging
- Component version: 21.1.0
Most models can work normally, but a user’s device crashed because it could not parse the payload of the data message.
This is the code.
class MyFirebaseMessagingService : FirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) {
if (remoteMessage.data.isNotEmpty()) {
val notificationType = remoteMessage.data.getValue("notification_type").toInt()
}
}
}
This is the payload when I pass the parameters to https://fcm.googleapis.com/fcm/send.
{
"data":{
"notification_type":1
},
"to":"xxxxxxxxxxx"
}
I get the report from Crashlytics.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Common AWS IoT Events issues and solutions
See the following section to troubleshoot errors and find possible solutions to resolve issues with AWS IoT Events. Errors. Detector model creation errors ......
Read more >Could not parse request body into json: Unexpected character ...
I am missing a comma after the income line. Here is another example. Could not parse request body into json: Unexpected character (\'}\'...
Read more >Failed to parse json data? | Apple Developer Forums
use JSONDecoder().decode. to parse data. {"aaa": "value", "bbb": 1}. it generated error: Unexpected error: dataCorrupted(Swift.DecodingError.
Read more >Common CSV Template Error Messages and How to Fix Them
An error message that begins “Failed to parse file” indicates that the uploaded CSV file is invalid in some way. Watershed supports UTF-8 ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@chliangGoogle I found that I did not receive the same crash from the same device in the past two days. Thank you.
Here is the payload when I pass the parameters to https://fcm.googleapis.com/fcm/send.
Here is the code in onMessageReceived.
Here is the report from Firebase Crashlytics.
This report is currently only received on Samsung Galaxy J6 (Android 8.0), and no problem with the emulator used in Android Studio.
Unfortunately, I do not own this type of device, and it comes from a customer.
I tried to find an image file and install it to the emulator to reproduce this problem, but Samsung’s official website does not provide an image file of this model.
https://developer.samsung.com/galaxy-emulator-skin/overview.html
For business purposes, I receive an average of 130 crash reports a day.