title: Phonegap how to download and open pdf file in android app
body: <p>recently i am working on a android apps build in phonegap, i am quite new with mobile development and this i smy first appsbut, and i am stuck when try to download some documents (pdf, doc, jpg) to local storage and open it, after search through google and i tried to follow <a href="https://stackoverflow.com/questions/13375234/how-to-open-downloaded-file-pdf-zip-docx-etc-in-phonegap-app">this solution</a>. </p>
  
  <p>I followed the exact code in the example and below is how i call the plugins:</p>
  
  <pre><code>window.plugins.downloader.downloadFile(url,'/sdcard/download/', 'test.pdf', true, downloadOkCallbak, downloadErCallbak);
      window.plugins.pdfViewer.showPdf('/sdcard/download/test.pdf');
  </code></pre>
  
  <p>The url is my remote file, when i execute it, i got error: "TypeError: window.plugins is undefined". Anyone help is appreciated.</p>
  
  <p><strong>[update]</strong> My code of showPdf function:</p>
  
  <pre><code>public String showPdf(String fileName) {
  
      File file = new File(fileName);
  
      if (file.exists()) {
          try {
              Uri path = Uri.fromFile(file);
              Intent intent = new Intent(Intent.ACTION_VIEW);
              intent.setDataAndType(path, "application/pdf");
              intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  
  
              //intent.setData(Uri.parse(fileName));
              this.ctx.startActivity(intent);
              return "";
          } catch (android.content.ActivityNotFoundException e) {
              System.out.println("PdfViewer: Error loading url "+fileName+":"+ e.toString());
              return e.toString();
          }            
  
      }else{
          return "file not found";
      }
  
  }
  </code></pre>
  
  <p><strong>[Update 2]</strong> I got below error in web console: Uncaught ReferrenceError: LocalFileSystem is not defined at ...</p>
  
  <p>What could be the issue?</p>