Fork me on GitHub
随笔 - 213  文章 - 13  trackbacks - 0

Openresty 官方模块
Openresty 三方模块














  • 积分 - 120011
  • 排名 - 185



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, 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 working for Android with Unity: on Unity/Android error (No JNI_OnLoad found in /system/lib/, skipping init)

  • i have complied the jabber-net library for mono 2.0. but when i run it in device i am getting this exception. 'ExecutionEngineException: Attempting to JIT compile method' How did you resolve it ? – Basit ZIa Apr 15 '14 at 10:05 
  • Don't remember. Could it be related to stripping level or C# version?… – Sunkas Apr 15 '14 at 12:26

Since nobody have answered here I how I solved it:

  1. ASmack for Android in a new Android project in eclipse
  2. Build a custom wrapper for ASmack with the basic public methods for login,logout,send messages et.c.
  3. Extract as jar library.
  4. Import jar into Unity3D
  5. Use Unity3D's AndroidJNI methods to call the public methods of the jar
  6. 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)
  7. Success!

A bit work is required and takes some time to debug and build, but it does work.

answered Sep 6 '12 at 12:00
  • Sorry, the video is unavailable. – naXa Sep 4 '16 at 8:42
  • Sorry to hear that (it was not my video). Removed the link. Hopefully my instructions will be of help. – Sunkas Sep 5 '16 at 10:52
  • And what about iOS client? As far as I know ASmack won't run on iOS. – naXa Sep 18 '16 at 13:36
  • As mentioned in the question we used for iOS. Note that this question was posted 2012, not sure what's the best option today. – Sunkas Sep 18 '16 at 16:19 
  • Ah, thanks! And sorry, I was inattentive. – naXa Sep 18 '16 at 17:30

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

answered Jul 12 '15 at 10:28
  • Thank you for your answer. It was a long time since I asked this question. I remembered that I emailed MatriX at the time with a few questions and at the time we could not use it since it lacked some requirement. Can't unfortunately remember what. – Sunkas Jul 13 '15 at 6:54
  • 1
    @Sunkas 2 years ago, AFAIK, there was problem with Sockets and Pro license in Unity ) – SuvitrufJul 13 '15 at 6:59 
  • 1
    @AlejandroHuerta I can say that it works in stand alone build for sure. I will test it on Android and iOS tomorrow. – Suvitruf Jan 20 '16 at 20:42
  • 1
    @AlejandroHuerta I've tested Matrix on iOS. It works. Will try Android later. – Suvitruf Jan 21 '16 at 20:57
  • 1
    @AlejandroHuerta it works on Android too. – Suvitruf Feb 24 '16 at 7:03
posted on 2018-07-11 11:23 思月行云 阅读(205) 评论(1)  编辑 收藏 引用 所属分类: Erlang

# re: C# - Best way to create a Android XMPP chat client in Unity3D 2018-07-11 11:24 思月行云

【推荐】超50万行VC++源码: 大型组态工控、电力仿真CAD与GIS源码库
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理