I have an android plugin (java) that I am using the JNI interface to communicate to, In this plugin I must send a String in a method call and seem to be fudging something up
Code:
Setting up JNI (works for all other functions so my Class Object is valid and working)
meth_SendCommand = JNI.GetMethodID(cls_TactorPlayer,
"SendCommand", "(Ljava/lang/String;)I");
Sending the Data
String str_command = "Hello Plugin!";
IntPtr ptr = Marshal.AllocHGlobal(str_command.Length);
Marshal.Copy(str_command.ToCharArray(), 0, ptr, str_command.Length);
int returnval = JNI.CallIntMethod(TactorPlayer, meth_SendCommand,ptr);
Capturing the Data within my Java Class
public int SendCommand(String command)
{
Log.d("--UNITYJAR-- SendCommand=", String.valueOf(command));
return 0;
}
Printing out my intptr that I send shows a valid address But I am guessing the way I Create the intptr to copying the data into it may be my issue
Help is greatly appreiciated, I am running out of ideas!
Thanks
Greg