Comments (3)
If your aircraft has just one battery:
try {
DJISampleApplication.getProductInstance().getBattery().setStateCallback(new BatteryState.Callback() {
@Override
public void onUpdate(BatteryState batteryState) {
batteryState.getVoltage();
}
});
} catch (Exception exception) {
ToastUtils.showToast(String.format("Error in getting battery voltage %s", exception.getMessage()));
}
If your aircraft has more than one battery:
int batteryPos = 0;
for (Battery battery : DJISampleApplication.getProductInstance().getBatteries()) {
int finalBatteryPos = batteryPos;
try {
battery.setStateCallback(djiBatteryState -> {
showToast(String.format("Battery %d: %d", finalBatteryPos, djiBatteryState.getVoltage()));
});
} catch (Exception exception) {
ToastUtils.showToast(String.format("Error in getting battery voltage %s", exception.getMessage()));
}
batteryPos++;
}
from mobile-sdk-android.
thanks for information
from mobile-sdk-android.
Thank you for @danilofariadutra response. The method you provided is indeed the correct way to obtain battery information in MSDK V4.
from mobile-sdk-android.
Related Issues (20)
- Crash when calling registerApp()
- Altitude rise function is not accurate HOT 9
- DJI Air 2S Intelligent Flight Modes (ActiveTrack, Spotlight, POI) HOT 5
- The execution could not be executed HOT 4
- How to get a distance value to the .jpg file? HOT 3
- DJI SDK V5 LRF HOT 1
- How do I delete markers? HOT 1
- GetFirmwareVersion throwing an exception HOT 1
- switch map to camera on Flight page HOT 3
- dji.v5.manager.SDKManager.<init>(): [0x0] Constructor returning without calling superclass constructor HOT 2
- Bezier Curve HOT 3
- 说实话,官网的tutorial实在是过时了 HOT 8
- Angle and Heading of Drone HOT 1
- Any plan to support Android 14 with targetSdk = 34 HOT 18
- Home location set manually HOT 3
- How to get Controller battery info in dji msdk 4.16 HOT 3
- How to get verticle speed of drone in dji msdk 4.16 HOT 3
- Please someone help me understand HOT 5
- Error and problem with Mavic 2 Enterprise advanced focal length from MSDK HOT 6
- update HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mobile-sdk-android.