解决方案 »

  1.   

    楼主怎么解决的啊???[email protected]
      

  2.   

    if(有sd卡){
             request.setDestinationInExternalPublicDir(savePath, filename);//-->eg./storge/sdcard0/transuner/apks
     }else{
     }
    。。
    c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI))是这样的类型:content://downloads/my_downloads/15,调用以下方法:public static String getFilePathFromUri(Context c, Uri uri) {
        String filePath = null;
        if ("content".equals(uri.getScheme())) {
            String[] filePathColumn = { MediaColumns.DATA };
            ContentResolver contentResolver = c.getContentResolver();         Cursor cursor = contentResolver.query(uri, filePathColumn, null,
                    null, null);         cursor.moveToFirst();         int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            filePath = cursor.getString(columnIndex);
            cursor.close();
        } else if ("file".equals(uri.getScheme())) {
            filePath = new File(uri.getPath()).getAbsolutePath();
        }
        Log.i(TAG, "filePath="+filePath);
        return filePath;
    }getFilePathFromUri(Context c, Uri.parse(content://downloads/my_downloads/15))得到apk路径:String uriString = "dat=/data/data/com.android.providers.downloads/cache/xxx. apk"打开的时候要用:
    intent.setDataAndType(Uri.fromFile(new File(uriString)), "application/vnd.android.package-archive");
    而不能用
    intent.setDataAndType(Uri.parse(uriString), "application/vnd.android.package-archive");