The goal of the program I am writing, is the following:
The code does this. The issue is, that the entire process takes over 5, sometimes up to 15 seconds to complete. The main bottleneck is the refreshFileListOfStorageLocation() function.
The code setup is the following:
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;
}
}
Like I said, this works; the problem is the time between refreshFileListOfStorageLocation() and it's onResult.
Is there any way to speed this up? I've tried:
none of these helped.
According to my correspondence with DJI Developer Support:
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.
So it does not seem, as if any further speed improvements through any API tricks are possible.