2015-04-30 47 views
0

我想通过android设备上安装的本机应用程序打开远程pdf文件。那可能吗 ? 我试图使用MIME类型的意图,但不起作用。我不想使用docs.google.com参考。可能通过原生android应用程序打开远程pdf文件?

有什么建议吗?

对于ref。 :

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(<remote_path>)); 
intent.setType("application/pdf"); 
PackageManager pm = getPackageManager(); 
List<ResolveInfo> activities = pm.queryIntentActivities(intent, 0); 
if (activities.size() > 0) { 
    startActivity(intent); 
} 

Intent intent = new Intent(Intent.ACTION_VIEW); 
intent.setDataAndType(Uri.parse(<remote_pdf>), "application/pdf"); 
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
+0

为您尝试的内容发布一些代码。 –

回答

0

前一段时间,我需要像你说实现的东西。我的客户对docs.google.com网址并不满意,而我找到的替代方法是将远程pdf下载到设备(在公用文件夹中,如外部存储),并开始使用pdf的本地Uri已被下载。否则,如果用户没有安装任何pdf阅读器,我启动了pdf格式的doc.google.com网址,但这个问题将在一些特殊情况下启动。

PD:如果您使用这种方法,请确保您将文件下载到公共目录中,否则pdf阅读器将无法打开它。

Regards

相关问题