Skip to content

Instantly share code, notes, and snippets.

@AlexPrestonSB
Last active August 7, 2020 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexPrestonSB/d7b5b9c948ab295e7e01b7bf33e383c6 to your computer and use it in GitHub Desktop.
Save AlexPrestonSB/d7b5b9c948ab295e7e01b7bf33e383c6 to your computer and use it in GitHub Desktop.
Receiver side for marking messages as delivered.
//Receiver Side
public class FirebaseMessagingServiceEx extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
try {
JSONObject sendBird = new JSONObject(remoteMessage.getData().get("sendbird"));
JSONObject channel = (JSONObject) sendBird.get("channel");
String channelUrl = (String) channel.get("channel_url");
//Mark the Message as Delivered
SendBird.markAsDelivered(channelUrl);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment