Edytuj

Udostępnij za pośrednictwem


UIDevice.BatteryLevel Property

Definition

Battery level indicator.

[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual float BatteryLevel { [Foundation.Export("batteryLevel")] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)] get; }
member this.BatteryLevel : single

Property Value

Battery percentage in the range [0..1] if battery monitoring is enabled, otherwise -1.

Attributes

Remarks

By default, BatteryMonitoringEnabled is false. In that situation, BatteryLevel will be -1 (and BatteryState will be Unknown).

A value of 1.0 indicates a fully-charged device, while 0.0 indicates an empty battery.

This can be used from a background thread.

Applies to