Skip to content
Peter Lewis edited this page Mar 2, 2023 · 1 revision

Starts an intent to open the file on Android.

Parameter Description
filepath Path of the file to open
filetype Type of the file, as a string, to be passed to Intent.setDataAndType
orientation (Optional) Orientation such as GUI_PORTRAIT or GUI_LANDSCAPE

Usage

To use this or other modules that require intents and URIs, you must add the following files to your app directory:

ANDROID_xml_services

 <provider
    android:name="android.support.v4.content.FileProvider"
    android:authorities="@[email protected]"
    android:exported="false"
    android:grantUriPermissions="true">
    <!-- resource file to create -->
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/file_paths">  
    </meta-data>
</provider>

xml/file_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths>
  <root-path name="root" path="." />
</paths>

Examples

(open-file (string-append (system-directory) (system-pathseparator) "test.mp4") "video/*")
(open-file (string-append (system-directory) (system-pathseparator) "test.pdf") "application/pdf")
Clone this wiki locally