Click or drag to resize

DLBatteryManagerAddBatteryEventListener Method

Namespace:  Com.Datalogic.Device.Battery
Assembly:  datalogic-xamarin-sdk (in datalogic-xamarin-sdk.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public int AddBatteryEventListener(
	IBatteryEventListener listener
)

Parameters

listener
Type: Com.Datalogic.Device.BatteryIBatteryEventListener
- The IBatteryEventListener that will be called to signal a BatteryEvent

Return Value

Type: Int32
intSuccess in case of success, otherwise a possible error code, matching one of the BatteryException error constants.
Exceptions
ExceptionCondition
BatteryException - in case of error, when exceptions are enabled through the ErrorManager singleton.
Remarks

Registers a IBatteryEventListener

to be notified of the BatteryManager events.

A call to addBatteryEventListener will fail with error ContextUnknown

if [!:Com.Datalogic.Device.Battery.DLBatteryManager.initBatteryEvents(Context)]

has not been not previously called to register the client's context.

Call RemoveBatteryEventListener(IBatteryEventListener)

before the application closes to properly shut down the listener and avoid memory leaks.

[Android Documentation]

See Also