1 case PDF:
2 try {
3 byte[] pdfAsBytes = Base64.decode(file.getContent(), Base64.DEFAULT);
4 File dir = getStorageDir();
5 File pdffile = new File(dir, file.getName());
6 if(!pdffile.exists())
7 {
8 pdffile.getParentFile().mkdirs();
9 pdffile.createNewFile();
10 }
11 Files.write(pdfAsBytes, pdffile);
12 Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
13 pdfIntent.setDataAndType(Uri.fromFile(pdffile), "application/pdf");
14 pdfIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
15 startActivity(pdfIntent);
16 } catch (IOException e) {
17 e.printStackTrace();
18 }
19
20 break;
21