SoundsDangerous
SoundsDangerous

Reputation: 738

Can't open a downloaded PDF in Adobe or Viewer via Intent

I'm trying to open a .pdf via a new Intent. The intent fires and the pdf app selection fires. When I select either app. The app displays 'unable to open document' I am passing data/data/com.android.providers.downloads/cache/document.pdf as the Uri which I am suspecting is the problem. There is no sd card. The pdf will open fine via the dowloads folder. Any help is appreciated.

Upvotes: 0

Views: 2643

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006674

I am passing data/data/com.android.providers.downloads/cache/document.pdf as the Uri

That file is not readable by third party applications.

The pdf will open fine via the dowloads folder.

Your main choices are to store the PDF on external storage (such as "the dowloads folder"), or to create a ContentProvider that can serve the file out of internal storage. This sample project demonstrates such a ContentProvider.

Upvotes: 3

Related Questions