OpenDocument¶
Enable the app user to open a file at a specified location with a selected third party application or build-in file viewer.
All the properties defined under Action are applicable to this action.
OpenDocument Properties¶
Property | Type | Required | Default |
---|---|---|---|
MimeType | string |
No | "image/jpeg" |
Path | string |
Yes | |
UseExternalViewer | boolean |
No | "false" |
_Type | const |
Yes |
MimeType¶
Specify the MIME type of the target document, only needed when opening document via OData Media direct binding on OData Service that doesn't support media content type annotation (@odata.mediaContentType).
For more information, see this. This value is required if the value of media content type annotation is not a valid Mime Type.
The file extension is determined based on the MIME type to create a local temporary file for iOS and Android. For Android, the MIME types must be supported by the apps installed on the device. The system will launch the appropriate application to view the content based on the MIME type. For iOS, the QLPreviewController is used to view documents, and the file extension determines how QLPreviewController displays the document. For Web, this is not required.
- type:
string
- default:
"image/jpeg"
Path¶
Path to the location of the file. Value can be: Prefixed with res:// (file is embedded in the main bundle); A full path (file is located in the application's sandbox system); Https url (http not supported)
- type:
string
UseExternalViewer¶
Indicates if the action use external viewer. This property is optional. The Build-in file viewer supports below types: PDF, Text, Image, Video, Audio and Zip. This property works on Android only. The built-in file viewer does not support passcode-protected file for now.
- type:
boolean
- default:
"false"
_Type¶
- type:
const
The value of this property must be:
"Action.Type.OpenDocument"
Action Result¶
Refer to the MDK Guide to understand what an action result is.
The success ActionResult of this action is an empty string. The failure ActionResult is an error message.
Examples¶
// OpenDocument.action
{
"Path": "/path/to/document.pdf",
"_Type": "Action.Type.OpenDocument"
}
{
"Path": "res://document.pdf",
"_Type": "Action.Type.OpenDocument",
"UseExternalViewer" : true
}
{
"Path": "https://some.externalserver.xyz/images/someimage.jpg",
"_Type": "Action.Type.OpenDocument",
"UseExternalViewer" : false
}
// OpenDocument for OData Media
{
"Path": "/MyMDKApp/Services/MyOData.service/Products(1)/$value",
"_Type": "Action.Type.OpenDocument"
}
{
"Path": "/MyMDKApp/Services/MyOData.service/Products(1)/$value",
"MimeType": "application/pdf",
"_Type": "Action.Type.OpenDocument"
}
{
"Path": "/MyMDKApp/Services/MyOData.service/{@odata.readLink}/$value",
"MimeType": "{MimeType}",
"_Type": "Action.Type.OpenDocument"
}
// OpenDocument for OData Stream
{
"Path": "/MyMDKApp/Services/MyOData.service/Products(1)/Document",
"_Type": "Action.Type.OpenDocument"
}
{
"Path": "/MyMDKApp/Services/MyOData.service/Products(1)/Document",
"MimeType": "application/pdf",
"_Type": "Action.Type.OpenDocument"
}
{
"Path": "/MyMDKApp/Services/MyOData.service/{@odata.readLink}/Document",
"MimeType": "{MimeType}",
"_Type": "Action.Type.OpenDocument"
}