Quickblox-Flutter JNI与本机C ++分离

问题描述

我在Flutter应用中使用Quickblox进行聊​​天。建立连接后,聊天即可正常进行。当应用程序发送到后台时,我按照Quickblox文档的建议将连接设置为关闭。但是,当我重新打开我的应用程序时,在事件(QBChatEvents.RECEIVED_NEW_MESSAGE)中它不再收到消息。尽管已在日志中发送和接收消息,但是此事件不再起作用。日志显示此异常,

Tried to send a platform message to Flutter,but FlutterJNI was detached from native C++. Could not send. Channel:

这是我订阅的活动,

QB.chat.subscribeChatEvent(QBChatEvents.RECEIVED_NEW_MESSAGE,(data) {
         // my implementaion here
      });

我已经从他们的文档中添加了此实现。

class _SomeScreenState extends State<SomeScreen> with WidgetsBindingObserver {
  
@override
initState() {
  super.initState();
  WidgetsBinding.instance.addobserver(this);
}

@override
void dispose() {
  WidgetsBinding.instance.removeObserver(this);
  super.dispose();
}
  
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
  switch (state) {
    case AppLifecycleState.resumed:
      try {
        await QB.chat.connect(userId,userPassword);
        } on PlatformException catch (e) {
        // Some error occured,look at the exception message for more details
        }
      break;
    case AppLifecycleState.paused:
      print("app in paused");
      try {
        await QB.chat.disconnect();
      } on PlatformException catch (e) {
        // Some error occured,look at the exception message for more details
        }
      break;
}

我在做什么错了?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)