Stop receiving FCM notifications when log out from the app in android?

SreeeeSreeee INMember ✭✭✭✭✭

I have implemented push notifications on my xamarin forms project using FCM. The notifications are starts receiving when a new message is sent by a member of the group(Same like WhatsApp).

I want to stop receiving notifications from the app when I log out. Currently, I got the notification even I was logged out from the app. Is there any way to stop receiving the notification on the logged out state in android part?

Best Answer

  • SreeeeSreeee IN ✭✭✭✭✭
    Accepted Answer

    I solved this in the following way.

    When a user logged out from the app, I start a REST API call to make the fcmid of the user to 0 and When the user logs in, again I start a new REST API call and save the fcmid to DB.

    By this way, the user is not able to receive the notification when he/she is in log out state and able to receive the notification when logs in.


Sign In or Register to comment.