Reputation: 380
I am using Moquette Android Broker. So, compiling the maven lib and using the jars within an Android Studio project works fine!
import org.eclipse.moquette.server.Server;
Server server = new Server();
server.startServer();
So thats the java code, in Unity I am wrapping the function calls like:
AndroidJavaClass server = new AndroidJavaClass("org.eclipse.moquette.server.Server");
server.Call("startServer");
However, The Unity project is building without any Error, but when I start I do not get any Error and also no Debug output of the call (neither from Unity, not from the java plugins). So Unity is not complaining but also the java code is not executed i guess.
Any ideas?
Upvotes: 0
Views: 46
Reputation: 4903
Use AndroidJavaObject instead of AndroidJavaClass, like this:
AndroidJavaObject server = new AndroidJavaObject("org.eclipse.moquette.server.Server");
server.Call("startServer");
If you wanted to invoke a static method, you can use AndroidJavaClass, but then you would have to use the CallStatic(...) method.
AndroidJavaClass server = new AndroidJavaClass("org.eclipse.moquette.server.Server");
server.CallStatic("startServer");
Upvotes: 1