1

I am working on app that has to open a pdf file in an external pdf application. It works fine, the file is opened in read-only mode. but this file can be shared via Facebook, gmail etc. I want to restrict it from sharing, as per privacy purpose.

Thanks in advance

Usman Nisar
  • 3,031
  • 33
  • 41

1 Answers1

2

You would need to create a whitelist to limit which intent is fired when you want to open the PDF in an external application. See this for an approach.

[EDIT] If someone stumbles upon this question later, once you fire an intent to open an external application, there is no way to control what that application does with your document.

Community
  • 1
  • 1
Rahin
  • 943
  • 6
  • 21
  • Thanks Rahin. I think you didn't got my point. Your suggested code is to allow those apps on which my pdf file is to be used/opened. My point is if I open my file in external pdf app, now here, can I restrict my file to be shared. such like I can't edit that file here same way how can I restrict its sharing. Thanks for your help again – Usman Nisar Oct 29 '13 at 07:18
  • Oh I'm sorry, I did misunderstand your question. I faced a similar dilemma recently and my research indicated that once you're out of the scope of your app, you cannot control what that app does with your document. How I worked around it was to implement what I said in my answer since you're in control of what apps can access your document. – Rahin Oct 29 '13 at 13:09
  • Once you allow other apps to access your PDFs, you can't prevent their sharing. Up to some degree you can prevent the sharing of the contents of your PDFs if you go for some DRM scheme. – mkl Oct 29 '13 at 13:10
  • Even if you use a DRM scheme, wouldn't you need to open the PDF in a DRM-compatible reader? – Rahin Oct 29 '13 at 14:07
  • There are some DRM schemes claiming not to require such a special reader. Admittedly, I have no experience with them, though. – mkl Oct 29 '13 at 20:24