ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Mobile specific functions / Phone functions
  • Battery
  • Handling errors
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
PowerStatus (Function)
In french: EtatAlimentation
Warning
From version 26, this function is available for backward compatibility. Use the SysPowerStatus function.
Used to get various information about the battery (main or secondary) of the device on which the application is running.
Example
// Status of main battery?
Info("The battery is charged to: " + EtatAlimentation(ChargePercentage) + " %")
Syntax
<Result> = PowerStatus(<Type of information> [, <Battery>])
<Result>: Integer or boolean according to the type of information
  • Requested information,
  • Empty string ("") if the requested information is not available.
<Type of information>: Integer constant
Specifies the requested type of information:
ACLineStatus
  • True if the device is plugged in,
  • False otherwise.
ChargeLevelCharge level of battery:
  • 0: no battery.
  • 1: high level.
  • 2: low level.
  • 3: critical level.
ChargePercentagePercentage of battery load.
Charging
  • True if the battery is charging,
  • False otherwise.
RemainingLifeRemaining lifetime (in seconds) of battery.
AndroidAndroid Widget iPhone/iPad This constant is not available.
TotalLifeTotal lifetime (in seconds) of battery.
AndroidAndroid Widget iPhone/iPad This constant is not available.
<Battery>: Optional boolean
  • True (by default) to get information about the main battery of device,
  • False to get information about the secondary battery of device.
AndroidAndroid Widget No information can be retrieved about the secondary battery. If <Battery> is set to False, <Result> will correspond to an empty string ("").
Remarks

Battery

  • AndroidAndroid Widget No information can be retrieved about the secondary battery.
  • AndroidAndroid Widget iPhone/iPad The returned information is invalid in emulator mode.

Handling errors

Caution: PowerStatus does not return an error code.. To determine if this function has generated an error, use ErrorInfo with the errMessage constant.
Business / UI classification: Business Logic
Component: wd300android.aar
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 10/17/2024

Send a report | Local help