배터리 상태 | 앱 기본 정보 및 환경체크 | Appbox iOS SDK 가이드
배터리 상태
배터리 잔량 가져오기
AppBox.shared.getBatteryLevel(completion:)
Swift
1
AppBox.shared.getBatteryLevel { value, error in
2
guard error == nil else { return }
3
print(value)
4
}
1
[AppBox.shared getBatteryLevelWithCompletion:^(NSInteger value, NSError *error) {
2
if (error) { return; }
3
NSLog(@"%d", value);
4
}];
Request 항목 정의
| Request 항목 | 필수여부 | 설명 | 기본값 |
|---|---|---|---|
completion | 필수 | 결과를 받는 콜백. 메인 스레드에서 한 번 호출됩니다 | - |
Response 항목 정의
| Response 결과값 | |
|---|---|
| 값 | Int |
| 오류 | 실패 원인. NSError |
화면 불필요. Int입니다. Android는 Float라 값 처리가 다릅니다
웹 브릿지에서는 배터리 상태의 application.getBatteryLevel입니다.