How to send uci messages from c# app to stockfish on android? I downloaded the binary of Android Stockfish arm64-v8a and looked in the CPP source files. In main() there is all initialization, and then there is UCI::loop(), which catches standard input with getline() and writes back with sync_cout(). How can I write to the engine from a c# (xamarin) application? And is it necessary to make some additional initialization?

I found this,
which could be close to my problem, but maybe it is not. I don't want to spend three days just to see I'm doing complete nonsense.

Also I don't know how to recognize Stockfish's console. Is there only one console, no matter how many different libraries the program can use?

As I don't understand the technical part much, I'm including a screenshot of what I expect to be the Stockfish I should communicate with :-). If it is wrong from the beginning, please let me know.



EDIT: What file type is the stockfish-8-arm64-v8a, is it android native library or native shell executable or something else? Where to put the file, how to set it up (in Visual Studio 2015), how to call it from code? I have some code that I tried here but still I can't make it work.
When you're using C#, you can use any UCI engine in the same manner.  With C# you have to add an event handler to the OutputDataReceived event (and optionally the ErrorDataReceived event).  As a quick example:

ProcessStartInfo si = new ProcessStartInfo() {
    FileName = uciPath,
    UseShellExecute = false,
    CreateNoWindow = true,
    RedirectStandardError = true,
    RedirectStandardInput = true,
    RedirectStandardOutput = true
};

myProcess = new Process();
myProcess.StartInfo = si;
try {
    // throws an exception on win98
    myProcess.PriorityClass = ProcessPriorityClass.BelowNormal;
} catch { }

myProcess.OutputDataReceived += new DataReceivedEventHandler(myProcess_OutputDataReceived);

myProcess.Start();
myProcess.BeginErrorReadLine();
myProcess.BeginOutputReadLine();

SendLine("uci");
SendLine("isready");
SendLine("ucinewgame");


And the methods alluded to above:

    private void SendLine(string command) {
        myProcess.StandardInput.WriteLine(command);
        myProcess.StandardInput.Flush();
    }

    private void myProcess_OutputDataReceived(object sender, DataReceivedEventArgs e) {
        string text = e.Data;
        //Debug.WriteLine("[UCI] " + text);
    }


This is an incredibly simplified example.  In my own code I have a semaphore in order to fully process each output line before moving on to the next one and several semaphores in the UCI start and "isready" handling.

For a full overview of the UCI protocol, check out the specification.