在 DJI Android SDK 中调用 refreshFileListOfStorageLocation() 需要很多秒才能产生结果(mavic
Calling refreshFileListOfStorageLocation() in the DJI Android SDK takes many seconds to produce a result (mavic
我正在编写的程序的目标如下:
- 用大疆御mavic 2企业版拍一张jpg图片
- 将 jpg 图像下载到已连接的 android 应用程序中
代码就是这样做的。问题是,整个过程需要超过 5 秒,有时甚至需要 15 秒才能完成。主要瓶颈是 refreshFileListOfStorageLocation() 函数。
代码设置如下:
mMediaManager = DJISampleApplication.getProductInstance().getCamera().getMediaManager();
camera = DJISampleApplication.getProductInstance().getCamera();
camera.startShootPhoto(new CommonCallbacks.CompletionCallback() {
@Override
public void onResult(DJIError djiError) {
mMediaManager.refreshFileListOfStorageLocation(SettingsDefinitions.StorageLocation.INTERNAL_STORAGE, new CommonCallbacks.CompletionCallback() {
@Override
public void onResult(DJIError djiError) {
newPicture();
});
});
void newPicture() {
mediaFileList = mMediaManager.getInternalStorageFileListSnapshot();
MediaFile lastImage = mediaFileList.get(mediaFileList.size()-1);
lastImage.fetchFileData(destDir, names[0], new DownloadListener<String>() {
@Override
public void onSuccess(String s) {
deleteAllFilesFromDrone();
return;
}
}
就像我说的,这行得通;问题是 refreshFileListOfStorageLocation() 和 onResult 之间的时间。
有什么办法可以加快速度吗?我试过:
- 将无人机存储中的文件数量保持在最大 1,
- 通过 addUpdateFileListStateListener 创建一个 FileState 侦听器,尽管这只会触发一次
- 检查 FileListState 并仅刷新,如果状态为 INCOMPLETE 或 RESET
none 其中有帮助。
根据我与大疆开发者支持的通信:
Unfortunately, the universal answer is that the speed is what it is
and there's not anything that can be done to speed up the process
other than downloading a preview of the media file or manually taking
the SD card out and downloading the media directly onto a computer.
所以看起来似乎不可能通过任何 API 技巧进一步提高速度。
我正在编写的程序的目标如下:
- 用大疆御mavic 2企业版拍一张jpg图片
- 将 jpg 图像下载到已连接的 android 应用程序中
代码就是这样做的。问题是,整个过程需要超过 5 秒,有时甚至需要 15 秒才能完成。主要瓶颈是 refreshFileListOfStorageLocation() 函数。
代码设置如下:
mMediaManager = DJISampleApplication.getProductInstance().getCamera().getMediaManager();
camera = DJISampleApplication.getProductInstance().getCamera();
camera.startShootPhoto(new CommonCallbacks.CompletionCallback() {
@Override
public void onResult(DJIError djiError) {
mMediaManager.refreshFileListOfStorageLocation(SettingsDefinitions.StorageLocation.INTERNAL_STORAGE, new CommonCallbacks.CompletionCallback() {
@Override
public void onResult(DJIError djiError) {
newPicture();
});
});
void newPicture() {
mediaFileList = mMediaManager.getInternalStorageFileListSnapshot();
MediaFile lastImage = mediaFileList.get(mediaFileList.size()-1);
lastImage.fetchFileData(destDir, names[0], new DownloadListener<String>() {
@Override
public void onSuccess(String s) {
deleteAllFilesFromDrone();
return;
}
}
就像我说的,这行得通;问题是 refreshFileListOfStorageLocation() 和 onResult 之间的时间。
有什么办法可以加快速度吗?我试过:
- 将无人机存储中的文件数量保持在最大 1,
- 通过 addUpdateFileListStateListener 创建一个 FileState 侦听器,尽管这只会触发一次
- 检查 FileListState 并仅刷新,如果状态为 INCOMPLETE 或 RESET
none 其中有帮助。
根据我与大疆开发者支持的通信:
Unfortunately, the universal answer is that the speed is what it is and there's not anything that can be done to speed up the process other than downloading a preview of the media file or manually taking the SD card out and downloading the media directly onto a computer.
所以看起来似乎不可能通过任何 API 技巧进一步提高速度。