Android usb storage refresh

304 Views Asked by At

There is a program currently being developed.

The app works with the usb connected When the file in usb is changed,

the file is loaded as the changed file at the first time.

However, if you try again with a connection in the future, the loaded file will continue to load the previous file, not the latest file.

I searched for various methods and tried to refresh using a scanner among them.

It was not a solution.

Is there any way to solve this problem?

Codes I Tried

1. MediaScannerConnection.scanFile (mContext, new String[] {getStorageDirectories()}, null, null);


2. final Intent scanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
   final Uri contentUri = ff.getUri();
   scanIntent.setData(contentUri);
   mContext.sendBroadcast(scanIntent);
0

There are 0 best solutions below