You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
I am integrating GetStream in my app, and I’m facing issues with device token management and user logout. The problem occurs when a user logs in from multiple devices. Calls are being sent to all devices instead of just the active one, and I want to manage the device tokens more effectively.
Problem:
Scenario 1: Handling Login on Multiple Devices
When a user logs in with the same user ID on different devices, I want to remove all the previous push tokens associated with that user. I’ve tried using the getDevices() and removeDevice() functions, but I am not able to implement this successfully. I want to ensure that when a user logs in on a new device, all old push tokens are removed, preventing the notification from being sent to all devices.
Scenario 2: Logout
When a user clicks the logout button, I want to remove the current device’s push token from Stream. I am not able to find the correct method to handle this, or I’m unsure how to properly implement it.
What I’ve Tried:
I have attempted using the getDevices() method to retrieve devices associated with the user and removeDevice() to delete them, but it doesn’t seem to remove the tokens as expected.
I have also tried to implement token removal on logout, but the behavior isn't what I intended.
Expected Behavior:
When a user logs in on a new device, the previous device tokens should be cleared.
When the user logs out from a device, only the token from that specific device should be removed.
Environment:
Stream version: 0.7.1
Platform: Both Android and iOS
Programming Language: Flutter
Please help me understand how to correctly handle these scenarios with GetStream's API. If there's a better way to approach this, I’d appreciate any guidance or suggestions.
The text was updated successfully, but these errors were encountered:
Your approach using getDevices() and removeDevices() is correct. By default, calling connect() on the StreamVideo instance registers the device token in the backend. If you'd like to handle this manually, you can set registerPushDevice: false when calling connect().
To implement this:
After a successful login, call connect(registerPushDevice: false) to connect the user without registering the device.
Use getDevices() to retrieve the list of registered devices and call removeDevice() for each to clear outdated ones.
Manually register the new device with addDevice().
For logout, calling disconnect() will remove the registered device automatically, or you can do so manually with removeDevice().
Description:
I am integrating GetStream in my app, and I’m facing issues with device token management and user logout. The problem occurs when a user logs in from multiple devices. Calls are being sent to all devices instead of just the active one, and I want to manage the device tokens more effectively.
Problem:
Scenario 1: Handling Login on Multiple Devices
When a user logs in with the same user ID on different devices, I want to remove all the previous push tokens associated with that user. I’ve tried using the
getDevices()
andremoveDevice()
functions, but I am not able to implement this successfully. I want to ensure that when a user logs in on a new device, all old push tokens are removed, preventing the notification from being sent to all devices.Scenario 2: Logout
When a user clicks the logout button, I want to remove the current device’s push token from Stream. I am not able to find the correct method to handle this, or I’m unsure how to properly implement it.
What I’ve Tried:
getDevices()
method to retrieve devices associated with the user andremoveDevice()
to delete them, but it doesn’t seem to remove the tokens as expected.Expected Behavior:
Environment:
Please help me understand how to correctly handle these scenarios with GetStream's API. If there's a better way to approach this, I’d appreciate any guidance or suggestions.
The text was updated successfully, but these errors were encountered: