Jiqiu ask you great God, now I'm starting a small program on the Smart TV, television is generally based on the U disk mounted outside the reserve, such as plug U disk can read or download the file to the inside.
Now I want to use downloadmanager U disk to download files, but it has been reported that the security issue, download unsuccessful. In a variety of television (or Konka, Haier) is the same error. But the same code and methods without any problems on the phone.
Jiqiu pointing whatever reason, how to improve it.
Part of the code is as follows:
File pathyr = new File ("/ mnt/usb/sdb4"); / / this directory are there, I myself wrote the manual download without any problems.
Uri downloadUri = Uri.parse (DOWNLOAD_FILE);
DownloadManager.Request request = new DownloadManager.Request (downloadUri);
request.setDestinationUri (Uri.fromFile (new File (pathyr, "100mb.jpg")));
log as follows:
04-20 10:54:05.593: W / dalvikvm (2315): threadid = 1: thread exiting with uncaught exception (group = 0x40f771f8)
04-20 10:54:05.665: E / AndroidRuntime (2315): FATAL EXCEPTION: main
04-20 10:54:05.665: E / AndroidRuntime (2315): java.lang.SecurityException: Destination must be on external storage: file :/ / / mnt/usb/sdb4/100mb.test.test
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.os.Parcel.readException (Parcel.java: 1327)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java: 181)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java: 135)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.content.ContentProviderProxy.insert (ContentProviderNative.java: 415)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.content.ContentResolver.insert (ContentResolver.java: 730)
04-20 10:54:05.665: E / AndroidRuntime (2315): at com.exercise.download.DownloadManager.enqueue (DownloadManager.java: 750)
04-20 10:54:05.665: E / AndroidRuntime (2315): at com.exercise.AndroidDownloadManager.AndroidDownloadManagerActivity $ 1.onClick (AndroidDownloadManagerActivity.java: 71)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.view.View.performClick (View.java: 3511)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.view.View.onKeyUp (View.java: 6073)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.widget.TextView.onKeyUp (TextView.java: 5595)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.view.KeyEvent.dispatch (KeyEvent.java: 3010)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.view.View.dispatchKeyEvent (View.java: 5500)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java: 1246)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java: 1246)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java: 1246)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java: 1246)
04-20 10:54:05.665: E / AndroidRuntime (2315): at com.android.internal.policy.impl.PhoneWindow $ DecorView.superDispatchKeyEvent (PhoneWindow.java: 1879)
04-20 10:54:05.665: E / AndroidRuntime (2315): at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent (PhoneWindow.java: 1361)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.app.Activity.dispatchKeyEvent (Activity.java: 2325)
04-20 10:54:05.665: E / AndroidRuntime (2315): at com.android.internal.policy.impl.PhoneWindow $ DecorView.dispatchKeyEvent (PhoneWindow.java: 1806)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.view.ViewRootImpl.deliverKeyEventPostIme (ViewRootImpl.java: 3327)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.view.ViewRootImpl.handleFinishedEvent (ViewRootImpl.java: 3300)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.view.ViewRootImpl.handleMessage (ViewRootImpl.java: 2460)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.os.Handler.dispatchMessage (Handler.java: 99)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.os.Looper.loop (Looper.java: 137)
04-20 10:54:05.665: E / AndroidRuntime (2315): at android.app.ActivityThread.main (ActivityThread.java: 4424)
04-20 10:54:05.665: E / AndroidRuntime (2315): at java.lang.reflect.Method.invokeNative (Native Method)
04-20 10:54:05.665: E / AndroidRuntime (2315): at java.lang.reflect.Method.invoke (Method.java: 511)
04-20 10:54:05.665: E / AndroidRuntime (2315): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java: 853)
04-20 10:54:05.665: E / AndroidRuntime (2315): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java: 579)
04-20 10:54:05.665: E / AndroidRuntime (2315): at dalvik.system.NativeStart.main (Native Method)
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Will you solve it
I have encountered this problem it
Reply:
You are not using the real machine test it! If it is a real machine, you first unplug the cable waiting SD card installed, because you stuck in the phone's SD card data line is read into the computer!
No comments:
Post a Comment