1# Battery Level 2 3> **NOTE** 4> - The APIs of this module are no longer maintained since API version 6. You are advised to use [`@ohos.batteryInfo`](js-apis-battery-info.md). 5> 6> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. 7 8 9## Modules to Import 10 11 12```js 13import battery from '@system.battery'; 14``` 15 16 17## battery.getStatus 18 19getStatus(Object): void 20 21Obtains the current charging state and battery level. 22 23**System capability**: SystemCapability.PowerManager.BatteryManager.Core 24 25**Parameters** 26 27| Name| Type| Mandatory| Description| 28| -------- | -------- | -------- | -------- | 29| success | (data: [BatteryResponse](#batteryresponse)) => void | No| Called when API call is successful.| 30| fail | (data: string, code: number) => void | No| Called when API call has failed.| 31| complete | () => void | No| Called when API call is complete.| 32 33**Example** 34 35```js 36export default { 37 getStatus() { 38 battery.getStatus({ 39 success: function(data) { 40 console.log('success get battery level:' + data.level); 41 }, 42 fail: function(data, code) { 43 console.log('fail to get battery level code:' + code + ', data: ' + data); 44 }, 45 }); 46 }, 47} 48``` 49 50## BatteryResponse 51 52| Name| Type| Description| 53| -------- | -------- | -------- | 54| charging | boolean | Whether the battery is being charged.| 55| level | number | Current battery level, which ranges from **0.00** to **1.00**.| 56