0

My app stops when i use this method request.setDestinationInExternalPublicDir I want to store Downloaded File in a DIRECTORY_MOVIES , but it does not work. I change CompileSDKVersion to 25 put it sill not working here is the code :

public void onNext(String downloadUrl) {
                            dismissWaitDialog();
                        String fileName = fmtStreamMap.title + "." + fmtStreamMap.extension;

                        /*Added By Morad*/
                        if (fmtStreamMap.extension.contains("mp3")){
                            Uri uri = Uri.parse(downloadUrl);
                            DownloadManager.Request request = new DownloadManager.Request(uri);
                            //request.allowScanningByMediaScanner();
                            request.setDestinationInExternalFilesDir(MainActivity.this, DIRECTORY_MUSIC, fileName);
                            request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                            downloadManager.enqueue(request);

                        }else{
                            Uri uri = Uri.parse(downloadUrl);
                            DownloadManager.Request request = new DownloadManager.Request(uri);
                                                                request.setDestinationInExternalPublicDir(DIRECTORY_MOVIES, fileName);
                            request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                            downloadManager.enqueue(request);
                        }
                    }

And i add all nececcery permissions in manifest. And This is the Log :

04-19 14:46:01.719 5229-5229/dodola.downtube E/SysUtils: ApplicationContext isenter code here null in ApplicationStatus
04-19 14:46:02.160 5229-5229/dodola.downtube E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
04-19 14:46:02.160 5229-5229/dodola.downtube E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)

                                                       [ 04-19 14:46:02.161  5229: 5229 D/         ]
                                                       HostConnection::get() New Host Connection established 0xa3d39e80, tid 5229
04-19 14:46:03.023 5229-5229/dodola.downtube E/DataReductionProxySettingListener: No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp
04-19 14:46:04.621 5229-5335/dodola.downtube E/emuglGLESv2_enc: device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glVertexAttribPointer:291 GL error 0x501
04-19 14:47:03.541 5229-6292/dodola.downtube E/ACodec: [OMX.google.vp9.decoder] storeMetaDataInBuffers failed w/ err -1010
04-19 14:47:03.541 5229-6292/dodola.downtube E/OMXNodeInstance: getParameter(1:google.vp9.decoder, ParamVideoAndroidVp8Encoder(0x6f600007)) ERROR: UnsupportedIndex(0x8000101a)
04-19 14:47:21.734 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de2d0
04-19 14:47:23.877 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de030
04-19 14:47:27.685 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:47:58.365 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9c3c3260
04-19 14:48:19.005 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9c3c3260
04-19 14:48:22.455 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:49:17.740 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9c3c3260
04-19 14:49:20.212 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:49:23.262 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:49:29.835 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:49:35.055 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:49:37.993 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0

I tried alot fo solution but nothing works with me ؛( Please Help me... Thank you

  • Please explain **in detail** what "it does not work" means. "And i add all nececcery permissions in manifest" -- if you are running on Android 6.0 or higher, and your `targetSdkVersion` is 23 or higher, you may need to implement runtime permissions as well. – CommonsWare Apr 21 '17 at 11:33
  • method request.setDestinationInExternalPublicDir i want to save the downloaded file in phone gallery, – مراد الحارثي Apr 21 '17 at 11:47

0 Answers0