Skip to content

Instantly share code, notes, and snippets.

@hiranya911
Last active December 25, 2018 21:16
Show Gist options
  • Save hiranya911/7063d9c22a2d7a51b6cb794ab9330dc0 to your computer and use it in GitHub Desktop.
Save hiranya911/7063d9c22a2d7a51b6cb794ab9330dc0 to your computer and use it in GitHub Desktop.
class CryptoAlertMessagingService: FirebaseMessagingService() {
override fun onMessageReceived(message: RemoteMessage?) {
message?.notification?.let {
Log.d(TAG, "Message Notification Body: ${it.body}")
val mainHandler = Handler(mainLooper)
mainHandler.post {
Toast.makeText(applicationContext, "${it.body}", Toast.LENGTH_SHORT).show()
}
}
}
companion object {
private const val TAG = "MessagingService"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment