Best way to create a Android XMPP chat client in Unity3D

I am trying to create a iOS and Android XMPP chat client using Unity/C#/Mono. I got a fully functional chat client working for iOS using Jabber.net, but it does not work for Android. So does anyone have any idea of a library that works with Unity/C# for Android?

This post discusses Android and XMPP solutions, but have not found any way of connecting this to Unity: Android and XMPP: Currently available solutions

This is my question related to getting Jabber.net working for Android with Unity: Jabber.net on Unity/Android error (No JNI_OnLoad found in /system/lib/libc.so, skipping init)


Since nobody have answered here I how I solved it:

  • ASmack for Android in a new Android project in eclipse
  • Build a custom wrapper for ASmack with the basic public methods for login,logout,send messages et.c.
  • Extract as jar library.
  • Import jar into Unity3D
  • Use Unity3D's AndroidJNI methods to call the public methods of the jar
  • Callbacks are set inside the Java-wrapper and call with "UnityPlayer.UnitySendMessage()" (classes.jar from Unity app package have to be imported into Eclipse project to compile)
  • Success!
  • A bit work is required and takes some time to debug and build, but it does work.


    Instead of all this manipulation with ASmack I recommend to use MatriX XMPP SDK. We are using this library for our Unity projects.

    And it works on Win, Mac, iOS, Android without any special manipulation. We have only 1 problem with this lib - can't make it work on in WebPlayer

    链接地址: http://www.djcxy.com/p/11148.html

    上一篇: 部分目录列表

    下一篇: 在Unity3D中创建Android XMPP聊天客户端的最佳方式