Question: My app is running I just screen off the device and no notification event is coming inside `FirebaseMessagingService`.

The notification is also not showing in the notification tray. Is that some bug with `FCM` or I am doing something wrong.

Please find attached code for `FCMService`.

```
public class FCMService extends FirebaseMessagingService {
    private static final Logger LOGGER = LoggerFactory.createLogger(FCMService.class);

    @Override
    public void onMessageReceived(RemoteMessage message) {
        if (null != message) {
            onNotificationReceived(message.getNotification(), message.getData());
        }
    }

    /**
     * Create and show a simple notification containing the received FCM message.
     * @param messageBody FCM message body received.
     * @param data Notification Data
     */
    private void onNotificationReceived(RemoteMessage.Notification messageBody, final Map<String, String> data) {
        LOGGER.info("Notification received... for data %s", data);
        if (AppPreferences.getInstance().isUserLogin()) {
            if (null != messageBody) {
               LOGGER.info("Notification received... Foreground Notification...%");
            } else {
               LOGGER.info("Notification received... Silent Notification...%");    
            }
        }
    }
}

```

Answer: 
No, you already have it covered.

Generally, don't use `is True` or `is False`, if you must have tri-state boolean, use:

```
if res is None:
    # handle None case
elif res:
    # handle true case
else:
    # handle false case

```

e.g. put the burden on the developer to use the tri-state correctly.

If the function needs to communicate more states, you should not use a boolean; in that case switch to using an [enum value](https://docs.python.org/3/library/enum.html).
You may create a function to map the values to corresponding functions. Something like:

```
# Function to map values
def do_something(res):
    return {
        None: func_1,  # Each `res` mapped to corresponding function
        True: func_2,
        False: func_3,
    }.get(res, func_4)

do_something(res)()
#                ^ call the function returned by `do_something()`

```

The equivalent of the above code can be written based on your logic *mentioned in question* as:

```
if res is not None:
    if res is True:                 
        func_2()     
    elif res is False:                   
        func_3()
    else:
        func_4()
else:                       
    func_1()

```