2012-11-22 45 views

回答

2

看看AndroidLib.dll庫。丹有一個類,將處理設備的電池水平報告在正常開機啓動裝置(即普通ROM啓動時)

爲AndroidLib

http://forum.xda-developers.com/showthread.php?t=1512685

主線程約AndroidLib

http://www.regawmod.com/software/windows/androidlib/current/documentation/index.html有關文檔

//使用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提供了他使用的代碼示例,並且您可以查看git hub來更好地瞭解他的調用。