Let’s start with the class definition. It has to inherit from Java.Lang.Object and implement the interface (for which it has been defined as a connector).
After sifting through the binding generator code, it turns out that we have to override two members, ThresholdClass and ThresholdType.
The ThresholdClass should point to the Java.Lang.Class for which it was registered as connector. Use JNIEnv.FindClass(“path”) for that.
TheresholdType should return Invorker C# Type.
The Validate, Dispose, and Constructor have been copied from the other autogenerated binding class. This is responsible for the reference counting of the object. You can just copy-paste that in your Invoker class.
The implementation of the IEmojiReplacer is what we really need here.
It points to the Java Method, creates method parameters, calls stack and, finally, calls the Java method using JNIEnv.CallVoidMethod(..).
We then allocate JValue arrays on stack using C# stackalloc (Thus, it won’t create garbage collector pressure. As far as I know, that was one of the optimizations made to the Bindings Generator by the Xamarin team, which had some positive performance impact on the Xamarin.Java code).
Make sure you set JValue array members within the original Java method parameters order, so the method is called properly with proper parameters.