我想将连接的android设备上的最新传入短信获取为字符串值。
您可以使用Process.StandardOutput访问通过调用adb.exe
返回的值
public static void Connect()
{
Process process = new Process();
ProcessStartInfo info = new ProcessStartInfo();
info.WindowStyle = ProcessWindowStyle.Hidden;
info.CreateNoWindow = true;
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
info.FileName = "adb/adb.exe";
info.Arguments = "shell svc data enable";
process.StartInfo = info;
process.Start();
// Synchronously read the standard output of the spawned process.
StreamReader reader = process.StandardOutput;
string output = reader.ReadToEnd();
// now the response is saved in the output variable and you can process it further.
}