我正在使用颤振通道来本地跟踪呼叫。但是广播接收器没有被触发。
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
EventChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setStreamHandler(
object : EventChannel.StreamHandler {
var eventSink: EventChannel.EventSink? = null
override fun onListen(p0: Any?, sink: EventChannel.EventSink) {
eventSink = sink
val receiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
println("Receiver start from main")
eventSink?.success("Receiver start to channel")
eventSink?.success(ss)
}
}
}
override fun onCancel(p0: Any?) {
eventSink = null
}
}
)
}