"The latter event is invoked when an actual notification is received from CGM. Now, If the application is not running, or is in the background, Cordova PushPlugin by default, will display the notification up into the notification drawer. If the user decides to click on it, the application would be brought to the foreground, and the +onNotification+ callback function would be called with the event set to 'message'. Here we can distinguish whether the application was in the foreground, cold-started (that is started running when the notification was clicked), or in the background when the notification was received. Depending on the state, you may decide to perform different operations.


In main other case is that we receive a message and we handle different senarios here if the application _only_ is in the background a notification will be shown. So in this forground case we might want to do something different then just log the message or play a sound.