How to detect the user logout and uninstall app to disable the push notification?

Hi all,

I am very new in mobile development. I am using ionic react. Currently I feel very confused about the push notification.

What I understand the working flow is:

  1. there are client side sdk (ionic app with capacitor firebase cloud messaging) and server side (node.js with firebase admin sdk)

  2. when the user install the app and logged in, then it will send to my server it’s device token at once, I will save his device token in my user database. When I want to send this user message, then I use the package: firebase admin sdk.

My question is:

  1. what happened if the user uninstalled the app? How to detect whether the user uninstalled the app?

  2. which package should I use in my node.js server side? Is it the “firebase admin sdk”?

(P.S I am not sure, if the working flow correct or not. )

Thanks very much for the help!

Best,
Conny

Hi, flow is correct. The only way to know if the user has deleted the application is push notifications. When you send a notification to the user, FCM will inform you that the user has unsubscribed. You can use admin sdk or rest api to send push notification.

1 Like