I know that this question is so old and there are a lot of answers on it, but I have not found my decision.
I want to update widget with firebase-cloud-messaging, but Firebase method onMessageReceived()
is not calling when app is in background.
I've tried to change notification to data as in the most of the answers here, but it not helps me: onMessageReceived()
is not calling when app is even in foreground.
So, my Firebase JSON is:
{ "registration_ids": [ "ids" ],
"priority": "high",
"content_available": true,
"data": {
"id_request": "1229",
"unreadedAnnouncements": "4",
"requestsCount": "9",
"survaysCount": "5",
"sound":"default",
"title":"test",
"message": "test",
"body": "test" } }
If it matters, my Firebase-dependencies:
implementation 'com.google.firebase:firebase-core:10.2.1'
implementation 'com.google.firebase:firebase-messaging:10.2.1'
implementation 'com.google.firebase:firebase-auth:10.2.1'
Maybe there are some new solutions? On the SO there are the most of solutions from 2016.