According to THIS ARTICLE by Jeremy Meiss (jerdog) and THIS LINK by Chainfire, this behavior should be "normal", as the time being. The WRITE_MEDIA_STORAGE permission should be needed, but this is granted to system apps only.
As a workaround, in my activity I handle this SecurityException
like this (in pseudo-code):
Intent intent = new Intent(MyActivity.this, DownloadsService.class);
try {
intent.putExtra("COPY", false);
enqueue = dm.enqueue(request);
Log.d(DEBUG_TAG, "_ID " + enqueue + " enqueued");
} catch (SecurityException e) {
Log.w(DEBUG_TAG, e.getMessage());
// handle the path on etxSdCard here:
showSomeInfo();
intent.putExtra("COPY", true);
tempDownloadToSdcard(request);
}
startService(intent);
In DownloadsService
I have a BroadcastReceiver where I handle the finished download;
in its onStartCommand
I retrieve the boolean extra as:
doCopy = intent.getBooleanExtra("COPY", false);
and then inside the receiver:
if (doCopy) copyFileToExtSdCard();
Hope this clarifies and helps.