MaxRecursion
MaxRecursion

Reputation: 4893

windows application to get battery status of connected android phone

Is there any way get the battery status of android phone (Samsung Galaxy SIII specificaly) connected to you PC in your C#.NET windows application which is running on your PC?? Thanks in advance.

I think we have to take help of samsung mobile phone driver for this.

Upvotes: 1

Views: 1574

Answers (1)

Deadphoenix
Deadphoenix

Reputation: 88

Take a look at the AndroidLib.dll Library. Dan has a Class that will handle device battery level reporting with the device booted in normal boot(i.e. Normal rom bootup)

Main thread for AndroidLib

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

For Documentation about AndroidLib

http://www.regawmod.com/software/windows/androidlib/current/documentation/index.html

// Example Code using 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 += "%";
    }

using a form with a button named button1 And a Label named lblsomelabel

You will get the Connected Devices serial and then associate it with device.

the library then can be called to pull the battery level as indicated.

Hope this helps. Dan's Github has examples of his code in use as well as you can look at the git hub to better understand his calls.

Upvotes: 2

Related Questions