Attachment Viewer Plugin
(Android, iOS, Windows 10) The Attachment Viewer plugin enhances the viewing of an attachment within a WebView.
When you use this plugin, the opening of an attachment is seamless. The user does not have to download the file and then manually open the attachment. If no suitable viewer is present, the plugin displays an error message.
Whether or not the unlock screen is shown after viewing an attachment is determined by the passcode policy. If the lock timeout is greater than the time it took you to view the attachment, then no unlock screen is displayed.
Android
Attachments open inside the WebView or in a third-party viewer, depending on the file
format. Certain MIME types, such as .png images, open directly in the WebView. For
other file types, the file is downloaded and you view the attachment in a
third-party application. The attachment file is shared using a content provider, and
the third-party viewer is given read access to that file. Your app just launches an
intent to view the file, so it does not control which third-party app will be
selected to view the attachment. (There may be no suitable viewer available.) For
more information about content providers in Android, see http://developer.android.com/guide/topics/providers/content-providers.html.
When you are done viewing the attachment, pressing the back button returns you to the WebView and refreshes the page. The downloaded file is deleted after your app resumes.
iOS
The iOS Attachment Viewer plugin uses the native iOS UIDocumentInteractionController class, which provides in-app support for managing user interactions with files in the local system. It allows you to preview attachments and open them in 3rd-party apps. It presents an appropriate user interface for previewing, opening, copying or printing a specified file.
When you tap a link for an attachment (such as a PDF file), the iOS Attachment Viewer downloads it to the iOS temporary folder and shows a preview screen, allowing you to preview the attachment's contents. If you tap the Share button, a menu is shown for opening in 3rd party apps, copying, printing, and so on. If the file type is not supported, an error message is displayed.
After you close the preview, the downloaded attachment file and all related files in the iOS temporary folder are deleted.
Windows
Attachments open inside the WebView or in a third-party viewer, depending on the file format. Certain MIME types, such as .png images, open directly in the WebView. For other file types, the file is downloaded and you view the attachment in a third-party application. For example, you view PDF files in a third-party PDF viewer application. When you are done viewing the attachment, pressing the back button returns you to the WebView and refreshes the page.
The temporary files are deleted when your app launches or resumes from tombstone state. This means if you view an attachment and then go back to your app, the file is not deleted right away, or even when you quit the app. The start operation is required to delete the temporary files.