Reputation: 145
I am creating my app folder /Android/data/com.mycompany.myapp. It is empty at first. However it is not visible in Windows explorer. Doing this solves it:
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));
Unfortunately this is no longer supported in API 19 (4.4). What is the alternative?
For Intent.ACTION_MEDIA_SCANNER_SCAN_FILE I need to specify a file, not a folder. The same is true for MediaScannerConnection.scanFile...
Upvotes: 3
Views: 1091
Reputation: 145
I implemented this work-around:
announce this file to the media scanner with:
Uri uri = Uri.parse("file://" + m_appDir + "/tmp.x");
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));
This will make the file and the folder visible from Windows.
Upvotes: 5