can't open file downloaded through download manager api
Problem solved. The problem is in setting the MIME type for the downloaded file. By googling by default the server sends the file as its content type as application/x-download instead of application/pdf. So in the set mime type as pdf.
I changed this request.setMimeType(".pdf");
to request.setMimeType("application/pdf");
that's it.