Skip to content

Instantly share code, notes, and snippets.

@LloydBlv
Created May 13, 2025 08:55
Show Gist options
  • Save LloydBlv/6ebc41a82647680f63c6f2377cafa02c to your computer and use it in GitHub Desktop.
Save LloydBlv/6ebc41a82647680f63c6f2377cafa02c to your computer and use it in GitHub Desktop.
override fun onMessageReceived(remoteMessage: RemoteMessage) {
val title = remoteMessage.data["title"]
val body = remoteMessage.data["body"]
val deeplink = remoteMessage.data["deeplink"]
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(deeplink))
val notification = NotificationCompat.Builder(this, "channel_id")
.setContentTitle(title)
.setContentText(body)
.setContentIntent(PendingIntent.getActivity(this, 0, intent, 0))
.build()
NotificationManagerCompat.from(this).notify(1, notification)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment