title: How to Pause downloadmanager in android
body: <p>I want to allow the user to <strong>pause</strong> his download's with button click or click on the notification of the downloads and this is my code </p>
  
  <pre><code>downloadbutton.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
      if(Allow.equals(true)){
  
          Uri downloadUri = Uri.parse(DOWNLOAD_FILE);
          DownloadManager.Request request = new DownloadManager.Request(downloadUri);
  
  
          request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
          request.setAllowedOverRoaming(false);
  
          //request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
  
          id =  downloadManager.enqueue(request);
  
          //Save the request id
          SharedPreferences.Editor PrefEdit = preferenceManager.edit();
          PrefEdit.putLong(strPref_Download_ID, id);
          PrefEdit.commit();
  
  
  
  
  }
  </code></pre>
  
  <p>});</p>