Skip to content

Instantly share code, notes, and snippets.

@vreamer
Created August 26, 2020 08:15
Show Gist options
  • Save vreamer/f0d5a38dd07d210fe2d7a1e2c2de10bd to your computer and use it in GitHub Desktop.
Save vreamer/f0d5a38dd07d210fe2d7a1e2c2de10bd to your computer and use it in GitHub Desktop.
Invoke method channel
package com.example.direct_reply_notification
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import androidx.core.app.RemoteInput
class NotificationReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val remoteInput = RemoteInput.getResultsFromIntent(intent)
if (remoteInput != null) {
val title = remoteInput.getCharSequence(
NotificationHelper.KEY_TEXT_REPLY).toString()
Log.d("NotificationReceiver", title)
NativeMethodChannel.showNewIdea(title) // add this line to invoke method channel
NotificationHelper.showNotification(context)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment