DJI-Mobile-SDK-Tutorials / Android-MediaManagerDemo

This demo is designed for you to learn how to use the MediaManager to interact with the file system on the SD card of the aircraft's camera. You can use it to preview photos, play videos, download or delete files and so on.
MIT License
25 stars 19 forks source link

Download Button not working #15

Open irwinsantoso opened 3 years ago

irwinsantoso commented 3 years ago

I have a problem after selecting a media, and I clicked the download button an error toast appeared :

Download file failed The execution cannot be executed

How can I debug the issue ?

Drone : DJI Mavic 2 Pro DJI SDK Version : 4.14.1 Android Version : Android 11

Screenshot (48)

dji-dev commented 3 years ago

Agent comment from cheney.zeng in Zendesk ticket #47223:

Hi Developer,

Thank you for reach out to DJI Developer Support. Due to a Chinese Holiday there maybe a short delay in responding directly to your question - we apologize for any inconvenience this may cause you and look forward to addressing your ticket as soon as possible.

Warm Regards, DJI Developer Support

°°°

dji-dev commented 3 years ago

Agent comment from William Wong in Zendesk ticket #47223:

Dear Client Thank you for contacting DJI.

You need to check if you are using SD card. If you are using internal storage to store photos. You need to change the refreshFileListOfStorageLocation and getSDCardFileListSnapshot fucnctions.

Hopefully our solution can help you. Kindly Regards, DJI Developer Support

°°°

irwinsantoso commented 3 years ago

Thank you for the response, I have confirmed the use of SD card, and the thumbnail of the files appeared, but the download failed.

Is there a way to check where it went wrong ? I checked the error code is 255

dji-dev commented 3 years ago

Agent comment from William Wong in Zendesk ticket #47223:

Dear Client Thank you for contacting DJI.

  1. Try reload and download again.
  2. Check if your aircraft firmware is up to date.
  3. Check if the fetch file data function's destDir which is File destDir = new File(Environment.getExternalStorageDirectory().getPath() + "/MediaManagerDemo/"); exist or not.

Hopefully our solution can help you. Kindly Regards, DJI Developer Support

°°°

jeryini commented 2 years ago

Had exactly the same issue and it was due to point 3, I also suggest to instead define your destDir like the following:

private File destDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), "YourAppName");
grofattila commented 2 years ago

It turned out that if the directory/subdirectory does not exist, the method call will fail.

If you pre-create the chosen folder, the download button works as expected.