如何使用 Quickblox Xamarin nuget 从 Xmpp 消息流获取消息文本 [英] How to get message text from Xmpp message streem using Quickblox Xamarin nuget

查看:60
本文介绍了如何使用 Quickblox Xamarin nuget 从 Xmpp 消息流获取消息文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Xamarin,我安装了 QuickBlox Nuget (1.2.7):

但现在它不再支持 Xamarin,因此没有任何可用的文档可以通过加入组来尝试使其工作.但是,如果您按照@Dhruv Bhagat 的建议将其降级到 1.2.2 版本,它将起作用.

Using Xamarin, I installed the QuickBlox Nuget (1.2.7): https://www.nuget.org/packages/Quickblox.Sdk/

and using this tutorial: http://quickblox.com/developers/Sample-chat-xamarin this tutorial is probably out of date, as some of the code snippets do not work out of the box and some changes to classes names and functions needs to be done, but it's the best source I could find for Xamarin and QuicBlox.

I'm trying to send and receive messages and having some difficulties. While I can send messages successfully and see them in the chat history using the admin panel, i couldn't find a way to receive them with the message text.

The message received with message id, sender id etc, but the messageText field is always null. When I use getMessagesAsync to actively get the message (by its id or as part of the chat dialog history) i get a message with text. So the text is there, the event get called but the text stays null...

I tried different ways of sending and receiving messages, using:

Send Messages - both worked, the message was sent and can be seen using the admin panel:

1.

quickbloxClient.ChatXmppClient.SendMessage(...) 

2.

privateChatManager.SendMessage (messageText); 

Receive Messages - only the ChatXmppClient worked, the message received with all its details but the message text field is null:

1.

quickbloxClient.ChatXmppClient.MessageReceived += MessageReceived;


 public async void MessageReceived (object sender, MessageEventArgs messageEventArgs)
{
    if (messageEventArgs.MessageType == Xmpp.Im.MessageType.Chat && messageEventArgs.Message != null)
    {
        var message = messageEventArgs.Message; // contains message's details
        var text =  messageEventArgs.Message.messageText; // null
    }
}

/// received (the event fired) with message details but without message text (null)

2.

 privateChatManager.MessageReceived += MessageReceived;
/// the event doesn't get called

Any help would be appreciated.

解决方案

In the official documentation of Quickblox they have mentioned that before start chating in a group dialog you should join this dialog.

But now it's not supporting Xamarin anymore so there is no any documentation available using which one can try to make it work by joining group. but if you downgrade it to 1.2.2 version as suggested by @Dhruv Bhagat it will work.

这篇关于如何使用 Quickblox Xamarin nuget 从 Xmpp 消息流获取消息文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆