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

Hi guys, i want to ask how to provide FCM token.

Open SemenPapazov opened this issue 6 years ago • 2 comments

In my logs in firebase there are such a message "There are no notification tokens to send to".

SemenPapazov avatar Jun 11 '19 14:06 SemenPapazov

How about now? How do you solve that?

crisiscore avatar Mar 01 '20 04:03 crisiscore

FirebaseInstanceIdService is deprecated which you need to update manually to make it work.

  1. In .notifications.ChatFirebaseMessagingService you need to copy the onTokenChange from instanceid.service.SaveFirebaseInstanceIdService. Then you can delete SaveFirebaseInstanceIdService.class.

  2. change the onTokenChange() to onNewToken().

  3. Search for the classes: .core.ChatManager ; .core.authentication.ChatAuthentication; .core.authentication.task.RefreshFirebaseInstanceIdTask

  4. Change String token = FirebaseInstanceId.getInstance().getToken(); to FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(new OnSuccessListener<InstanceIdResult>() { @Override public void onSuccess(InstanceIdResult instanceIdResult) { String newToken = instanceIdResult.getToken(); Log.i(TAG_TOKEN, "RefreshFirebaseInstanceIdTask: token == " + newToken); } });

  5. in AndroidManifest delete service android:name=".instanceid.service.SaveFirebaseInstanceIdService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> </intent-filter> </service>

Bobbykart avatar Apr 11 '20 22:04 Bobbykart