PDF downloading link is not working

I am making an android application with mySQL database. I have made a PDF report that is to be downloading with I click on a button. Well, I used that link it the google chrome in my android device it works well. But, when I tried to use the same link in my application it doesn’t seem to be working. What I have done so far is that I want the file to be downloaded by a click of a button. So, I made the following code:

public class MainActivity extends ActionBarActivity {

private Button button;
private String LOGIN_URL =

protected void onCreate(Bundle savedInstanceState) {
    button = (Button) findViewById(R.id.mybutton) ;

    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            DownloadManager.Request request = new DownloadManager.Request(Uri.parse(LOGIN_URL));
            request.setTitle("File Downloading");
            request.setDescription("File is being Downloaded...");
            String File_name = URLUtil.guessFileName(LOGIN_URL, null, MimeTypeMap.getFileExtensionFromUrl(LOGIN_URL));
            request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, File_name);
            DownloadManager manager = (DownloadManager) MainActivity.this.getSystemService(Context.DOWNLOAD_SERVICE);
            Toast.makeText(MainActivity.this, "Downloading", Toast.LENGTH_LONG).show();



I exactly don’t know where the problem could be. Is it in the code or in my php file.

Source: php

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.