Plugin for Cordova 5.X to trigger a media scan on Android terminal.
First download the plugin in a folder:
git clone https://github.com/Pandazaur/cordova-plugin-android-mediascanner.git
Then go in your project folder and type:
cordova plugin add /path/to/cordova-plugin-android-mediascanner
You need to include the Javascript file:
<script type="text/javascript" src="MediaScanner.js"></script>
Now you wan trigger a media scan on a file like this:
MediaScanner.scanMedia('/path/to/your/file/fileToScan.txt',
function () {
console.log("Media scan completed");
}, function (err) {
console.log(err);
});