Responding to Power Events

On this page, when a power event is detected on your device, such as when the device is disconnected from a power supply, a JavaScript handler is invoked.

Try unplugging your device from its power supply.

Event information will appear here

Understanding Power Source Event Handling

The page contains a meta tag within its head tag, as shown:

<meta http-equiv="BatteryNavigate" 
		content="Javascript:onBatteryNavigate('%s', '%s', '%s', '%s', '%s');"/>

The page contains a div with an id of messageDiv:

<div id="messageDiv"></div>

The JavaScript handler (onScannerNavigate) receives the barcode information and displays it like so:

function onBatteryNavigate(acLineStatus, batteryStrength, backupBatteryStrength, batteryChemistry, minutesRemaining)
{
	var messageDiv = document.getElementById("messageDiv");
	messageDiv.innerHTML =
		"AC Line Status: " + formatForHtml(acLineStatus) + "<br/>"
		+ "Battery Strength: " + formatForHtml(batteryStrength) + "<br/>"
		+ "Backup Battery Strength: " + formatForHtml(backupBatteryStrength) + "<br/>"
		+ "Battery Chemistry: " + formatForHtml(batteryChemistry) + "<br/>"
		+ "Minutes Remaining: " + formatForHtml(minutesRemaining) + "<br/>";
}