After discovering that sending notifiactions from the Firebase console, if the app is in background the onMessageReceived() method is not called.
I therefore followed peoples advice to use a HTTP POST Request. I have been using postman to make a post request
https://fcm.googleapis.com/fcm/send
with 2 headers:
Content-Type: application/json
Authorization: key=ALsa.......6ryLiI
and body
{
"to" : "fzgh-aHiOd8:APA91bFcKuwuVq_2gbLydHkAZf9XLUzm9vPalh7EUQT3Kyj8mcW9raAs9QvxbHaGJ4-U4RnUJwJ3UaEarbMXiQ8rHnsx9UuYBDrOI9tJYB78_Z3VVR1l7H_6PGpCkdgINx8a4vvMXD9q",
"notification" : {
"body" : "Sales!",
"title" : "ID Phone",
"icon" : "myicon"
},
"data" : {
"data" : "sales",
}
}
Now, the notification does come into my app (which is good), but its still not the custom notifcation that I wanted. ie onMessageReceived() is still not being called.
Is there something I am missing?