Battery Battery Battery Battery Class

Provides information about the status of the phone's battery.

Syntax

Declaration

public sealed class Batterypublic sealed class BatteryPublic NotInheritable Class Battery

Remarks

Use the GetDefault() method to retrieve an instance of the Battery class.

Properties summary

Gets a value that indicates the percentage of the charge remaining on the phone's battery.

Gets a value that estimates how long is left until the phone's battery is fully discharged. Each unit value represents 100 nanoseconds.

Methods summary

Gets the default Battery object for the phone.

Events summary

Occurs when the value of RemainingChargePercent decreases by 1%.

Properties

  • RemainingChargePercent
    RemainingChargePercent
    RemainingChargePercent
    RemainingChargePercent

    Gets a value that indicates the percentage of the charge remaining on the phone's battery.

    public int RemainingChargePercent { get; }public int RemainingChargePercent { get; }Public ReadOnly Property RemainingChargePercent As int

    Property Value

    • int
      int
      int
      int

      A value from 0 to 100 that indicates the percentage of the charge remaining on the phone's battery.

  • RemainingDischargeTime
    RemainingDischargeTime
    RemainingDischargeTime
    RemainingDischargeTime

    Gets a value that estimates how long is left until the phone's battery is fully discharged. Each unit value represents 100 nanoseconds.

    public TimeSpan RemainingDischargeTime { get; }public TimeSpan RemainingDischargeTime { get; }Public ReadOnly Property RemainingDischargeTime As TimeSpan

    Property Value

    • A value that estimates how long is left until the phone's battery is fully discharged. Each unit value represents 100 nanoseconds.

    Remarks

    Divide by 10^7 to get the total number of seconds.

Methods

  • GetDefault()
    GetDefault()
    GetDefault()
    GetDefault()

    Gets the default Battery object for the phone.

    public static Battery GetDefault()public static Battery GetDefault()Public Static Function GetDefault() As Battery

    Returns

Events

  • RemainingChargePercentChanged
    RemainingChargePercentChanged
    RemainingChargePercentChanged
    RemainingChargePercentChanged

    Occurs when the value of RemainingChargePercent decreases by 1%.

    public event EventHandler RemainingChargePercentChangedpublic event EventHandler RemainingChargePercentChangedPublic Event RemainingChargePercentChanged

Device family

Windows Mobile Extension SDK (introduced v10.0.10240.0)

API contract

Windows.Phone.PhoneContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute

Details

Assembly

Windows.Phone.Devices.Power.dll