W/System.err﹕ java.lang.IllegalArgumentException: Unknown URL content://downloads/my_downloads

本文探讨了在Android中遇到的Download Manager禁用导致的UnknownURL错误,并提供了通过设置应用启用状态来重新激活Download Manager的方法。同时,讨论了如何引导用户手动启用此功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

异常:W/System.err﹕ java.lang.IllegalArgumentException: Unknown URL content://downloads/my_downloads


原文位置:http://stackoverflow.com/questions/21551538/how-to-enable-android-download-manager


问题描述:

I'm using Android Download Manager to download list of files. Lately I came across a crash report saying

Unknown java.lang.IllegalArgumentException: Unknown URL content://downloads/my_downloads

Then later, I figured it out that the reason is because user disabled Android Download Manager. I check if the Download Manager is disabled by checking it's package name with the code below.

int state = this.getPackageManager().getApplicationEnabledSetting("com.android.providers.downloads");


And now, I need to find a way to enable the Download Manager if it is disabled. I tried setting it's enable state with the permission in Manifest but I keep getting Security Exception.

this.getPackageManager().setApplicationEnabledSetting("com.android.providers.downloads", PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);

<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>


So I thought it might not be reachable because of it is a system app. (Google Play App does it).

Is there any way to redirect the user to the Download Manager Application Info view ? to let the user enables it ? If there is no way to enable it on run time programmatically.

分析:也就是说,抛出此异常的原因可能是“下载管理器”处于“停用”状态


(待续,)




评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值