ConnectyCube / android-messenger-app

Chat and voice / video calling app using ConnectyCube
https://connectycube.com
Apache License 2.0
51 stars 23 forks source link

ConnectyCube resets or deletes the user FCM Token from Firebase Messaging as well for the device after unsubscribe from pushes #98

Closed jddeep closed 2 years ago

jddeep commented 2 years ago

SubscribeService.unSubscribeFromPushes(applicationContext)

This is the line which is responsible for this. After uncommenting this the fcm token is survived even after logout and doesn't change for the user which is what we want.

jddeep commented 2 years ago

@TatankaConCube Please take a look here

TatankaConCube commented 2 years ago

@jddeep could you please provide the log after calling the SubscribeService.unSubscribeFromPushes(applicationContext). Do you have any errors there? What unexpected behavior do you get with this issue? Why do you need the new token after unsubscription?

jddeep commented 2 years ago

@TatankaConCube No there are no errors. All the process works good. We don't need new token. We want old token only. The issue is this line of code changes destroys the old token and a new token is generated by firebase messaging after re login. We removed the line and checked and everything was fine. The old token was reserved.

TatankaConCube commented 2 years ago

within SDK we call instanceID.deleteToken(senderId, FirebaseMessaging.INSTANCE_ID_SCOPE); and clean your data related to FCM, just FYI

jddeep commented 2 years ago

Well that is exactly what's causing this @TatankaConCube ! Can you tell why exactly are you doing this? And other than this what all things are you doing under the hood while unsubscribing

TatankaConCube commented 2 years ago

in my preview comment, I said, what we do while calling SubscribeService.unSubscribeFromPushes(applicationContext)

why exactly are you doing this

we do this for stopping receiving push notifications in the app.

But you can realize own logic for unsubscribing from push notifications, for this, you have to save the subscription id and use it for deleting subscription via our API:

ConnectycubePushNotifications.deleteSubscription(subscriptionId);
jddeep commented 2 years ago

Closing this for now