Is Charging
Summary
- Internal name:
IsCharging - Category: Battery
- Purpose: Check whether the device is currently charging. Branches the workflow based on charging state —
trueif any charger is connected,falseotherwise. - Task type: Condition
Compatibility
-
Minimum AndroMate version:
1.1.0 -
Maximum AndroMate version:
1.1.0 -
Minimum Android:
Android 13 (API 33) -
Maximum Android tested:
Android 16 (API 36) -
Required permissions: None
Detailed description
The Is Charging task reads the battery charging status from the Android battery broadcast (ACTION_BATTERY_CHANGED) and evaluates whether the device is actively charging. It acts as a condition node in the workflow: the workflow branches to the true path if charging, and to the false path otherwise.
A device is considered charging if EXTRA_STATUS equals BATTERY_STATUS_CHARGING or BATTERY_STATUS_FULL.
No special permissions are required — ACTION_BATTERY_CHANGED is a protected system broadcast available to all apps.
Input parameters
This task has no configurable input parameters.
Output parameters
This is a Condition task — it does not store a value. Instead, it directs workflow execution:
| Condition | Next step |
|---|---|
| Device is charging (status = Charging or Full) | true branch |
| Device is not charging | false branch |
Exceptions
This task does not throw exceptions.
Execution flowchart
flowchart TD
Start([▶ IsCharging]) --> Register[📡 Register ACTION_BATTERY_CHANGED\none-shot receiver]
Register --> ReadStatus[🔋 Read EXTRA_STATUS]
ReadStatus --> CheckCharging{Status = Charging\nor Full ?}
CheckCharging -->|Yes| TrueBranch([✅ true branch])
CheckCharging -->|No| FalseBranch([❌ false branch])
style Start fill:#e3f2fd
style TrueBranch fill:#c8e6c9
style FalseBranch fill:#ffcdd2
style Register fill:#fff9c4
style ReadStatus fill:#f3e5f5
style CheckCharging fill:#fff9c4
How it works:
- Register battery receiver: registers a one-shot receiver for
ACTION_BATTERY_CHANGED - Read status: extracts
EXTRA_STATUSfrom the battery intent - Evaluate condition: if status is
BATTERY_STATUS_CHARGINGorBATTERY_STATUS_FULL, takes thetruebranch; otherwise takes thefalsebranch
Code examples
Example 1 — Branch workflow based on charging state
Input parameter details
This task has no configurable input parameters.
Output parameter details
This is a Condition task — it stores no output variable. The result drives the workflow branching:
true branch
Taken when EXTRA_STATUS equals BATTERY_STATUS_CHARGING or BATTERY_STATUS_FULL.
false branch
Taken when the device is not charging.