简体   繁体   中英

Flutter Images and Video Saved using path_provider not showing in Gallery

I want to record a video or audio in my Flutter App and wants it to appear in gallery. How can I do it because path_provider is saving file to safe location and one need a rooted device to access it. I was trying Flutter Camera Plugin Example

Also asked on https://github.com/flutter/flutter/issues/20807

The reason I was facing the problem is that the example I was trying uses path_provider function "getApplicationDocumentsDirectory()" to store the files. By replacing above Function with "getExternalStorageDirectory()" I am able to store the file in the external directory and they appear in the Gallery.

您需要使用广播意图扫描媒体文件。

 sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(YOUR_PATH)));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM