배터리 상태 | 앱 기본 정보 및 환경체크 | Appbox SDK 가이드
배터리 상태
배터리 소모가 큰 기능 실행 전 안내를 주거나, 저전력 모드에 맞춘 처리가 가능합니다.
배터리 잔량 가져오기
AppboxSDK.application.getBatteryLevel()
Javascript
1
// 휴대폰 배터리 잔량 가져오기
2
AppboxSDK.application.getBatteryLevel(
(err, data) => {
3
if (err) {
4
console.error(
"배터리 잔량 가져오기 실패:",
"code:", err.code,
"message:", err.message
);
5
} else {
6
console.log(
"배터리 잔량(%) : ",
data.result
);
7
}
8
});
Response 항목 정의
| Response 결과값 | |
|---|---|
| data.result | 배터리 잔량 (ex : 75) |