chat21-android-sdk icon indicating copy to clipboard operation
chat21-android-sdk copied to clipboard

Why Chat21 SDK creating multiple tokens for Messages?

Open vikas-jain-plutus opened this issue 4 years ago • 6 comments

Can anyone please tell me to do this for any specific reason?

vikas-jain-plutus avatar Jan 20 '21 10:01 vikas-jain-plutus

Are your referring to authentication token or other?

andrealeo83 avatar Jan 20 '21 16:01 andrealeo83

Actually, I am already generating the Firebase Token using below method. FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() { @Override public void onComplete(@NonNull Task<InstanceIdResult> task) { if (!task.isSuccessful()) { fcm_token = task.getException().getMessage(); Log.w("FCM TOKEN Failed", task.getException()); } else { fcm_token = task.getResult().getToken(); Log.i("FCM TOKEN", fcm_token); } } });

But the problem is Chat21 SDK also registering new token and my previous token expired and I am not getting normal push notification. Is there any way we can restrict token generation from the Chat21 SDK?

vikas-jain-plutus avatar Jan 21 '21 11:01 vikas-jain-plutus

Or else we can get the new token in MyFirebaseInstanceIdService?

vikas-jain-plutus avatar Jan 21 '21 11:01 vikas-jain-plutus

If you authenticate the user outside Chat21 I think you should don't use the Chat21 authentication.

You must get the Firebase current user with: FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser();

Create an IChatUser e start the Chat21SDK with: ChatManager.start(this, mChatConfiguration, iChatUser);

See here an example: https://github.com/chat21/chat21-android-demo/blob/development_v2/app/src/main/java/chat21/android/demo/AppContext.java

andrealeo83 avatar Jan 21 '21 12:01 andrealeo83

I am not getting any notification when another user or member send me any message via Chat21 SDK. Is there any other configuration for getting chat notifications?

Thanks in advance 💯

vikas-jain-plutus avatar Feb 03 '21 17:02 vikas-jain-plutus

If you authenticate the user outside Chat21 I think you should don't use the Chat21 authentication.

You must get the Firebase current user with: FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser();

Create an IChatUser e start the Chat21SDK with: ChatManager.start(this, mChatConfiguration, iChatUser);

See here an example: https://github.com/chat21/chat21-android-demo/blob/development_v2/app/src/main/java/chat21/android/demo/AppContext.java

I am not getting any notification when another user or member send me any message via Chat21 SDK. Is there any other configuration for getting chat notifications?

vikas-jain-plutus avatar Feb 03 '21 17:02 vikas-jain-plutus