
This plugin enhances the viewing of an attachment within a web view. When using this plugin the opening of an attachment is seamless. The user does not have to download the file and then manually open the attachment. It displays an error message if an appropriate viewer is not installed, ensures the application is not reloaded when returning from the viewer and deletes the temporary file used to view the attachment. Specifically on iOS and Android, it opens the appropriate viewer in a separate InAppBrowser window when window.open(url_to_attachment_or_html_page) is called or a link is clicked on that contains target="_blank". On iOS a toolbar is shown which enables the user to close the InAppBrowser window. For additional details on the InAppBrowser see org.apache.cordova.inappbrowser.
Note, Kapsel requires a slightly modified copy of this plugin that is located at C:\SAP\MobileSDK3\KapselSDK\plugins\inappbrowser.
For additional details on the attachment viewer plugin see the JavaScript file in a project that includes this plugin at
project_name\plugins\com.sap.mp.cordova.plugins.attachmentviewer\www\attachmentviewer.jsor the JS Documentation at Using the Attachment Viewer.
The following examples will demonstrate this plugin and show why it is needed.
Viewing Attachments in Chrome
Viewing Attachments using a Cordova WebView
Viewing Attachments using the Attachment Viewer Plugin
C:\SAP\MobilePlatform3\Server\webapps\sapui5\AttachmentTest\pdf.pdf
C:\SAP\MobilePlatform3\Server\webapps\sapui5\AttachmentTest\pic.jpg
C:\SAP\MobilePlatform3\Server\webapps\sapui5\AttachmentTest\sample.html
C:\SAP\MobilePlatform3\Server\webapps\sapui5\AttachmentTest\word.docx
C:\SAP\MobilePlatform3\Server\webapps\sapui5\AttachmentTest\unknowntype.foobar
C:\SAP\MobilePlatform3\Server\webapps\sapui5\AttachmentTest\unknowntype2.foobar
C:\SAP\MobilePlatform3\Server\webapps\sapui5\AttachmentTest\mp3.mp3
C:\SAP\MobilePlatform3\Server\webapps\sapui5\AttachmentTest\mp4.mp4
cordova -d create C:\Kapsel_Projects\AtttachmentDemo com.mycompany.attachmenviewer AttachmentDemo
cd C:\Kapsel_Projects\AtttachmentDemo
cordova -d platform add android
cordova -d create ~/Documents/Kapsel_Projects/AtttachmentDemo com.mycompany.attachmenviewer AtttachmentDemo
cd ~/Documents/Kapsel_Projects/AtttachmentDemo
cordova -d platform add ioscordova -d plugin add org.apache.cordova.inappbrowserNotice the version of this plugin.C:\Kapsel_Projects\AtttachmentDemo>cordova plugins
org.apache.cordova.inappbrowser 0.6.0 "InAppBrowser"
C:\Kapsel_Projects\AtttachmentDemo\www\pdf.pdf
C:\Kapsel_Projects\AtttachmentDemo\www\pic.jpg
C:\Kapsel_Projects\AtttachmentDemo\www\sample.html
C:\Kapsel_Projects\AtttachmentDemo\www\word.docx
C:\Kapsel_Projects\AtttachmentDemo\www\unknowntype.foobar
C:\Kapsel_Projects\AtttachmentDemo\www\unknowntype2.foobar
C:\Kapsel_Projects\AtttachmentDemo\www\mp3.mp3
C:\Kapsel_Projects\AtttachmentDemo\www\mp4.mp4
cordova -d prepare


cordova -d plugin remove org.apache.cordova.inappbrowser
cordova -d plugin add com.sap.mp.cordova.plugins.attachmentviewer --searchpath "C:\SAP\MobileSDK3\KapselSDK\plugins"
or
cordova -d plugin add com.sap.mp.cordova.plugins.attachmentviewer --searchpath "/Users/i826567/SAP/MobileSDK3/KapselSDK/plugins"
This plugin has dependencies on other plugins. This will not be a manual step in a future SP after SP08.cordova -d plugin add com.sap.mp.cordova.plugins.i18n --searchpath "C:\SAP\MobileSDK3\KapselSDK\plugins"
cordova plugins add org.apache.cordova.dialogs
Notice the version of the InAppBrowser is now the version that is included as part of Kapsel.C:\Kapsel_Projects\AtttachmentDemo>cordova plugins
com.sap.mp.cordova.plugins.attachmentviewer 3.8.1 "AttachmentViewer"
com.sap.mp.cordova.plugins.authproxy 3.8.1 "AuthProxy"
com.sap.mp.cordova.plugins.corelibs 3.8.1 "CoreLibs"
com.sap.mp.cordova.plugins.i18n 3.8.1 "i18n"
org.apache.cordova.device 0.3.0 "Device"
org.apache.cordova.dialogs 0.3.0 "Notification"
org.apache.cordova.inappbrowser 0.6.0-patched "InAppBrowser"


Back to Getting Started With Kapsel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 24 | |
| 15 | |
| 13 | |
| 12 | |
| 11 | |
| 10 | |
| 9 | |
| 8 | |
| 8 | |
| 8 |