android 2.3以后版本开放了DownloadManager下载功能,如果手机中存在SD是不存在任何问题。现在的问题是如果手机中不存在SD,是不是就不能使用DownloadManager?还是有别的解决方案?
请高手指点!!!! 谢谢
------解决方案--------------------
Downloadmanager不能用就直接用http接口下载呗,自己管理
------解决方案--------------------
这个是支持的,在无SD情况下,不设置down.setDestinationInExternalFilesDir(context,null,apkname);会默认将下载的apk文件放在/data/data/com.android.providers.downloads/cache/xxx.apk 。
不过我现在的问题是:
在通知栏中点击刚才下载的apk文件时,无反应,兄弟,关于这步你可做过啊?联系QQ 260281186
------解决方案--------------------
//判断外部存储卡是否存在
if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
Toast.makeText(getApplicationContext(), "读取失败,SD存储卡不存在!", Toast.LENGTH_LONG).show();
return;
}
用SQLite数据库下载,应该可以吧,求指教
------解决方案--------------------
//判断外部存储卡是否存在
if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
Toast.makeText(getApplicationContext(), "读取失败,SD存储卡不存在!", Toast.LENGTH_LONG).show();
return;
}
//初始化File
String path=Environment.getExternalStorageDirectory().toString()
+File.separator
+"genwoxue"
+File.separator
+FILENAME;
file=new File(path);
//如果当前文件的父文件夹不存在,则创建genwoxue文件夹
if(!file.getParentFile().exists())
file.getParentFile().mkdirs();
------解决方案--------------------
加一个touch事件试试。