In my app I have a sign-in screen. When the app starts, the push-receiver gets started and after the user signs in is able to receive push notifications. When the user signs out, the app is still running and the user is presented with the sign-in screen. However the push receiver was already registered and still receives notifications. I want to avoid that. I don't want to receive any push notifications when the user is not signed in. There are a few solutions I can see:
Store the notifications when they arrive and then process them after the user signs in. The bad thing about this is security. If someone had access to the app other than the rightful user, they would have access to the push notifications, although these could be encrypted. Storing and recalling these notifications is a lot more work.
Use some Javascript api to terminate the running instance of the push receiver when the user signs out and then restart it when the user signs back in.
Modify your push receiver code to destroy the tls connection when the user signs out and then recreate it when they sign back in.
Call the receiver's setup method from the web page that gets loaded AFTER the user signs in. Maybe this is the best solution?
In my app I have a sign-in screen. When the app starts, the push-receiver gets started and after the user signs in is able to receive push notifications. When the user signs out, the app is still running and the user is presented with the sign-in screen. However the push receiver was already registered and still receives notifications. I want to avoid that. I don't want to receive any push notifications when the user is not signed in. There are a few solutions I can see:
Any suggestions on this? Thanks!