You can find all that information inside /proc/acpi/battery/. Each BATX (X is the battery number) corresponds to a battery in your system. To know the current percent you can use the info contained inside BATX/info and BATX/state.
My BAT0/info is :
present: yes
design capacity: 7650 mAh
last full capacity: 6784 mAh
battery technology: rechargeable
design voltage: 7200 mV
design capacity warning: 342 mAh
design capacity low: 206 mAh
capacity granularity 1: 10 mAh
capacity granularity 2: 25 mAh
model number: Primary
serial number:
battery type: LION
OEM info: Hewlett-Packard
An My BAT0/state is:
present: yes
capacity state: ok
charging state: discharging
present rate: unknown
remaining capacity: 4480 mAh
present voltage: 7519 mV
Hence, to know your battery percent you can divide your remaining capacity by the last full capacity. In this case it is :
remaining capacity / last full capacity = 4480 mAh/ 6784 mAh = 66.04%
You can easily parse those files and integrate this info to your apps.