Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# windows应用程序获取已连接android手机的电池状态_C#_Android_Windows_Samsung Mobile - Fatal编程技术网

C# windows应用程序获取已连接android手机的电池状态

C# windows应用程序获取已连接android手机的电池状态,c#,android,windows,samsung-mobile,C#,Android,Windows,Samsung Mobile,有没有办法在PC上运行的C#NET windows应用程序中获取连接到PC的android手机(具体为三星Galaxy SIII)的电池状态?? 提前谢谢 我想我们需要三星手机驱动程序的帮助。看看AndroidLib.dll库。Dan有一个类,该类将处理设备在正常启动(即正常rom启动)下启动时的设备电池电量报告 AndroidLib的主线程 有关AndroidLib的文档 //使用AndroidLib.dll的示例代码 private void button1_Clicked(object

有没有办法在PC上运行的C#NET windows应用程序中获取连接到PC的android手机(具体为三星Galaxy SIII)的电池状态?? 提前谢谢


我想我们需要三星手机驱动程序的帮助。

看看AndroidLib.dll库。Dan有一个类,该类将处理设备在正常启动(即正常rom启动)下启动时的设备电池电量报告

AndroidLib的主线程

有关AndroidLib的文档

//使用AndroidLib.dll的示例代码

private void button1_Clicked(object sender, EventArgs e)
    {
          string serial;
          android = AndroidController.Instance;
          android.UpdateDeviceList();
          serial = android.ConnectedDevices[0];
          device = android.GetConnectedDevice(serial);
          // this will give the label lblsomelabel the Value of the device battery level.
          lblsomelabel.Text = device.Battery.Level.ToString();
          lblsomelabel.Text += "%";
    }
使用带有名为button1的按钮的窗体 和一个名为lblsomelabel的标签

您将获取连接的设备序列号,然后将其与设备关联

然后,可以调用库来提取电池电量,如图所示

希望这有帮助。Dan的Github有他正在使用的代码示例,您也可以查看Github以更好地理解他的调用