多媒体库所有文件夹同步问题

This issue has been created since 2018-04-14.

请问针对其他app刚刚下载的文件如何做到同步,

如何同步根目录下的所有文件 , 到多媒体库中

TonnyL wrote this answer on 2018-04-14

嗨, @Yis92

你可以通过发送广播来同步文件到媒体库:

/**
* Send a broadcast to sync the media library.
* 
* @param context Context
* @param filePath Path of your file
*/
fun syncMediaStore(context: Context, filePath: String) {
    val intent = Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE)
    intent.data = Uri.fromFile(File(filePath))
    context.sendBroadcast(intent)
}
Yis92 wrote this answer on 2018-04-14

貌似这个只能同步某个具体的文件,而且还只支持4.4以下版本,我需要同步所有的文件,您的项目中【文件里】也有这个同步的问题,可否您修改下这个问题,提交下,我学习下

TonnyL wrote this answer on 2018-04-14

你可以试试 https://www.jianshu.com/p/45f1b6e9b1a5 这篇文章提供的方法。很抱歉,我的这个项目并没有考虑到需要手动到去同步所有到文件,只考虑了MediaStore中现有的文件。

Yis92 wrote this answer on 2018-04-14

谢谢

TonnyL wrote this answer on 2018-04-14

不客气,有任何问题欢迎随时交流😉

More Details About Repo
Owner Name TonnyL
Repo Name Charles
Full Name TonnyL/Charles
Language Kotlin
Created Date 2018-02-08
Updated Date 2022-04-15
Star Count 428
Watcher Count 12
Fork Count 34
Issue Count 5

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
[bug]crash at no stream. 0 2021-04-29 2022-07-27
Kernel crash on incorrect TableauSymmetry 1 2017-05-21 2022-08-02
Getting Discord Webhook Notification but NO Web Panel Connection 1 2022-01-29 2022-07-24
Realm support 1 2021-09-01 2021-12-22
Something wrong with compact menus 1 2021-07-17 2022-08-11
Acer Swift SF314-43: Boot entries overwritten on reboot 1 2021-09-19 2022-08-08
Make the docker container work with an existing couchDB 4 2021-01-07 2022-08-07
Clustered CouchDB 3 2021-01-22 2021-12-31
Downloads Failing 3 2021-11-02 2021-12-26
CPU 9980xe support. 32 2019-09-30 2022-01-10
tq_exchange returning error message 10 2021-01-25 2022-07-16
Mastercard credit card brand not recognized correctly 1 2021-11-08 2022-08-08
Use Microsoft.CodeAnalysis.PublicApiAnalyzers to make public api change at compile time 1 2022-01-04 2022-07-07
nmap is now a dependency? 6 2021-02-17 2022-05-27
转换格式勾选采样频率时报错“bassmix.dll丢失或损坏” 1 2021-09-06 2022-06-21
Need Null Safety Version 2 2021-04-06 2022-08-04
Please Update Your Package 1 2021-07-13 2022-07-11
Could 'Web Access' be enabled for .csproj files? 3 2021-04-19 2022-07-31
Remove some auto-generated fields while comparing live and desired manifest 0 2022-04-13 2022-08-10
proxy socks5 issue 1 2021-01-09 2022-01-19
Add support for Solid JSX 1 2020-05-12 2022-07-25
Cannot type ^ character 2 2021-01-05 2022-08-03
The color of the Item text in Edit Priority and confirm() is not configurable 0 2021-09-19 2022-07-25
There's a bug! 0 2021-02-23 2022-01-09
bug in project search dialog 0 2021-06-30 2021-10-02
Unlisted package version still seen in the version list API 2 2022-01-11 2022-07-30
Bump lodash from 4.17.4 to 4.17.19 1 2020-07-16 2022-06-25
Lifecycle management concerns 2 2022-03-04 2022-08-12
Add colours to CLI logger 1 2015-08-20 2022-07-02
Ability to exclude non applicable checks from a report 0 2022-03-30 2022-08-03
A few uninitialized value use bugs in MagickCore 1 2021-10-16 2022-07-31
Possibility to cancel multiple scans running at the same time on /scan/history/ 1 2022-01-16 2022-06-28
Issue with "Accessibility": (short summary here please) 1 2022-02-21 2022-07-22
Add AsyncProperties to DeepNew support 1 2022-07-13 2022-07-25
Remove `cleanupOnEntityDeleted` behavior 0 2022-06-22 2022-07-25
Allow validation rules to only run on update 0 2022-06-24 2022-07-25
mec172xevb_assy6906: tests/arch/arm/arm_irq_vector_table failed to run 2 2022-04-22 2022-07-29
When a tex file is in `tex` or `LaTeX-expl3`, the button of view pdf disappears and snippet of synctex from cursor doesn't work. 0 2022-02-28 2022-07-07
standardize async dbapi exceptions with access pattern 1 2022-05-23 2022-07-26
set_session cannot be used inside a transaction with pool_pre_ping 0 2022-05-11 2022-07-13
CUJ: How to implements defaults for resourcequota and limitrange in namespace provisioning use-case 7 2022-06-08 2022-08-12
All in-cluster components should be installed using kpt 0 2022-07-13 2022-08-13
✨ Update Primes 0 2021-03-01 2021-12-27
Action Required: Fix Renovate Configuration 0 2021-01-21 2022-07-29
aacdec - Change Codec Name 0 2020-07-08 2022-08-13
Investigate JDK9+ compatibility of Test Proxy Support in Performance Framework. 1 2022-01-24 2022-08-06
Keep Smoothie's dependancies up to date 1 2022-02-06 2022-07-27
PDF files as input 2 2019-01-29 2021-11-03
Open file limit 0 2021-10-29 2022-01-20
Microphone stops working after pressing the clear button. 5 2021-09-15 2022-02-01