Notification in background

61
February 13, 2018, at 4:32 PM

When I open the app and send notification from the FireBase console , the onMessageReceived works fine. The app has its small icon , Notification sound ,etc.. But when the app is killed or is closed , no notification sound or a small icon appears.

Answer 1

After GCM the google changed the GCM as FCM, And FCM are containing two type of payload one is Notification and another One is Data payload when you are posting notification with Notification Payload then app will be in background then onMessageReceived not called but when in foreground onMessageReceived called, But if you put Data payload then all-time onMessageReceived is called.

Using Notification Payload

onMessageReceived called in the only foreground not in background

Using Data Payload

onMessageReceived called every time

READ ALSO
How to display cards in a Card Game in Java and have them clickable for selection?

How to display cards in a Card Game in Java and have them clickable for selection?

I am programming a game of cards in Java, and everything is going well, but I have come up with a problem regarding the user interfaceThere are 4 players (1 Human 3 AI) and 54 cards

50
polynomial roots in finite fields java or c++ library

polynomial roots in finite fields java or c++ library

Is there any library, java or c++, for working on polynomials in finite fields, for example finding the roots of a polynomial in a finite field? The finite field can be Zp and p may be a very large prime number

47
Java 8 does not wait for ffmpeg process output buffer read completion

Java 8 does not wait for ffmpeg process output buffer read completion

We need to create multiple clips from video, to do so we are using ProcessBuilder to create a new processes, Please fine code below

78
soap attachments with spring-boot

soap attachments with spring-boot

How do I extract multipart attachments from the request using spring-boot web services?

52