2015-04-30 83 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

相關問題