使用 FlutterFragmentActivity 在 Flutter 中进行深度链接
我有一个连接到 ChromeCast 的 Straming 应用程序。
它使用这个包来处理连接: https://github.com/samyakkkk/flutter_video_cast
它需要使用 FlutterFragmentActivity 才能正常连接,但是,如果我使用它,我就失去了深度链接的能力。如果我需要使用 FlutterFragmentActivity 我怎样才能成功?
这是使 Chromecast 工作但破坏 DeepLinking 的代码:
class MainActivity : FlutterFragmentActivity() {
override fun provideFlutterEngine(context: Context): FlutterEngine? {
return AudioServicePlugin.getFlutterEngine(context)
}
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
provideFlutterEngine(applicationContext)
}
}
这是使 DeepLinking 工作但破坏 ChromeCast 连接的代码:
class MainActivity : FlutterActivity() {
override fun provideFlutterEngine(context: Context): FlutterEngine? {
configureFlutterEngine(FlutterEngine(applicationContext))
return AudioServicePlugin.getFlutterEngine(context)
}
}
我需要使用“AudioServicePlugin”来播放音频,因此还需要设置此行。
I have an Straming app that connects to ChromeCast.
It uses this package to handle the connection:
https://github.com/samyakkkk/flutter_video_cast
It needs to use FlutterFragmentActivity so the connection can work, but, if i use it, i lose the hability to DeepLinking. How can i succed in this if i need to use FlutterFragmentActivity?
Here is the code that makes Chromecast Work but breaks DeepLinking:
class MainActivity : FlutterFragmentActivity() {
override fun provideFlutterEngine(context: Context): FlutterEngine? {
return AudioServicePlugin.getFlutterEngine(context)
}
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
provideFlutterEngine(applicationContext)
}
}
Here is the code that DeepLinking works but breaks the ChromeCast connection:
class MainActivity : FlutterActivity() {
override fun provideFlutterEngine(context: Context): FlutterEngine? {
configureFlutterEngine(FlutterEngine(applicationContext))
return AudioServicePlugin.getFlutterEngine(context)
}
}
I need to use "AudioServicePlugin" for playing audio, so this line need to be set also.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论