'How to terminate notifications when user logout

I integrated Firebase Messaging using local notification in my app, when User A send friend request to User B ,, then User B receives notification. But the problem is when User B logout and User A send friend request to User B then notification also showing to User B even User B is logout.. So basically how can I terminate notifications when user is logout ??

I don't want to show notifications to Logout Users..

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source