If you want to do it manually,

You can install an engine of your choice onto each phone, start a match on each phone (one where the engine is playing white, and one where it is playing black) and simply input the first engine's move into the second engine, input its reply back into the first one and so on.

To do it automatically,

You can use the Universal Chess Interface. What exactly to do will depend on your specific use case and needs but you can read more about it [here](https://www.chessprogramming.org/UCI).