-2

I have a mass storage device that when I write on a sector, it does something on this sector and write on it again. I wrote a program in Android that writes on mass storage device's sectors, but when sector was changed, the value in the file does not change. I want to refresh my mass storage device so that changes are visible. I am sorry about my bad grammar, I am Iranian and I can't speak English well

1 Answers1

0

I have had same issue.. Please try this..

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://" + Environment.getExternalStorageDirectory())));

or

sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + Environment.getExternalStorageDirectory())));

or you can refer this link also..

SD card files updated programmatically are not updated in windows explorer

Hope this might help you..

Community
  • 1
  • 1
  • Thanks for quick reply,i try this but not change my file on device. I try mount and unmount programmatically and work it but speed is important for me and i problem with his speed . i want otherthing with high speed – amin yaghoti Feb 03 '16 at 04:34
  • Have you try this code?? MediaScannerConnection.scanFile (this, new String[] {file.toString()}, null, null); Add this line before sendBroadcast method.. it might work.. – Raghav Mehta Feb 03 '16 at 05:46
  • this not work for me , i change sector and scan file with this code but not change my file – amin yaghoti Feb 03 '16 at 07:33