{"_id":"@a3j/cordova-plugin-mx-file-opener","_rev":"2-6e41d0128b47d973e04f8c7ef7cb7d7c","name":"@a3j/cordova-plugin-mx-file-opener","dist-tags":{"latest":"3.0.6"},"versions":{"3.0.5":{"name":"@a3j/cordova-plugin-mx-file-opener","version":"3.0.5","keywords":["ecosystem:cordova","cordova-android","cordova-ios","cordova-windows","cordova-electron"],"author":{"name":"pwlin05@gmail.com"},"license":"MIT","_id":"@a3j/cordova-plugin-mx-file-opener@3.0.5","maintainers":[{"name":"a3j","email":"alex@a3jgroup.com"}],"homepage":"https://gitlab.com/a3j/cordova-plugin-mx-file-opener#readme","bugs":{"url":"https://gitlab.com/a3j/cordova-plugin-mx-file-opener/issues"},"dist":{"shasum":"21efabe66c2b88f70e10e17e4dac2daeb7f064c4","tarball":"https://registry.npmjs.org/@a3j/cordova-plugin-mx-file-opener/-/cordova-plugin-mx-file-opener-3.0.5.tgz","fileCount":16,"integrity":"sha512-mCUPqqP9PF7yNWL3SGAggAw39Yt4wDseVXQBtvgYYFDVcI9ViVpnsl7RZXP/5wP4FMN5/wGr+SWw8CjJxKatrQ==","signatures":[{"sig":"MEYCIQChcuO3+iFxz+E4aHj5anEPJmvuvDjV/u/YuMfxWD1aKwIhAL6NSWi04T1sclZXBFPsDhazNhy4DwL7GAU0zSc5Q7ZG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44314},"cordova":{"id":"cordova-plugin-file-opener2","platforms":["android","ios","windows","electron"]},"engines":{"cordova":">=6.0.0"},"gitHead":"e29abf017a7b21f6c5ec748cf21618dd734550c5","_npmUser":{"name":"a3j","email":"alex@a3jgroup.com"},"repository":{"url":"git+https://gitlab.com/a3j/cordova-plugin-mx-file-opener.git","type":"git"},"_npmVersion":"11.6.2","description":"A File Opener Plugin for Cordova. (The Original Version)","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cordova-plugin-mx-file-opener_3.0.5_1775323230164_0.1679082996719241","host":"s3://npm-registry-packages-npm-production"}},"3.0.6":{"name":"@a3j/cordova-plugin-mx-file-opener","version":"3.0.6","description":"A File Opener Plugin for Cordova. (The Original Version)","cordova":{"id":"cordova-plugin-file-opener2","platforms":["android","ios","windows","electron"]},"repository":{"type":"git","url":"git+https://gitlab.com/a3j/cordova-plugin-mx-file-opener.git"},"keywords":["ecosystem:cordova","cordova-android","cordova-ios","cordova-windows","cordova-electron"],"engines":{"cordova":">=6.0.0"},"author":{"name":"pwlin05@gmail.com"},"license":"MIT","bugs":{"url":"https://gitlab.com/a3j/cordova-plugin-mx-file-opener/issues"},"homepage":"https://gitlab.com/a3j/cordova-plugin-mx-file-opener#readme","gitHead":"6175c1de0946f071e2cd6f516be146d34721396c","_id":"@a3j/cordova-plugin-mx-file-opener@3.0.6","_nodeVersion":"22.22.2","_npmVersion":"11.6.2","dist":{"integrity":"sha512-Yy/s8dxVUp1qLArzcDKjEaHmzMCXJF+V8w26cMD299vR1kXCHrf/HSxFoQFdr8Jv7FIW5tjOkAeS7n/ThxI0Wg==","shasum":"b1148f67d0bfaf74cb36383608d075207281a939","tarball":"https://registry.npmjs.org/@a3j/cordova-plugin-mx-file-opener/-/cordova-plugin-mx-file-opener-3.0.6.tgz","fileCount":16,"unpackedSize":44461,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCRWzpzqD9NQ90dB18E+B74PTmovTEccCm6bZrK89hupQIgeg/tnRh8nrEYrX3KMutUtcmcCLpwiQIdtereSSeKjbk="}]},"_npmUser":{"name":"a3j","email":"alex@a3jgroup.com"},"directories":{},"maintainers":[{"name":"a3j","email":"alex@a3jgroup.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cordova-plugin-mx-file-opener_3.0.6_1786491703559_0.7979157511398818"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-04T17:20:30.110Z","modified":"2026-08-11T23:41:43.905Z","3.0.5":"2026-04-04T17:20:30.374Z","3.0.6":"2026-08-11T23:41:43.702Z"},"bugs":{"url":"https://gitlab.com/a3j/cordova-plugin-mx-file-opener/issues"},"author":{"name":"pwlin05@gmail.com"},"license":"MIT","homepage":"https://gitlab.com/a3j/cordova-plugin-mx-file-opener#readme","keywords":["ecosystem:cordova","cordova-android","cordova-ios","cordova-windows","cordova-electron"],"repository":{"type":"git","url":"git+https://gitlab.com/a3j/cordova-plugin-mx-file-opener.git"},"description":"A File Opener Plugin for Cordova. (The Original Version)","maintainers":[{"name":"a3j","email":"alex@a3jgroup.com"}],"readme":"# A File Opener Plugin for Cordova\r\n\r\n[![Latest Stable Version](https://img.shields.io/npm/v/cordova-plugin-file-opener2.svg)](https://www.npmjs.com/package/cordova-plugin-file-opener2) [![Total Downloads](https://img.shields.io/npm/dt/cordova-plugin-file-opener2.svg)](https://npm-stat.com/charts.html?package=cordova-plugin-file-opener2)\r\n\r\nThis plugin will open a file on your device file system with its default application.\r\n\r\n```js\r\ncordova.plugins.fileOpener2.open(\r\n    filePath,\r\n    fileMIMEType,\r\n    {\r\n        error : function(){ },\r\n        success : function(){ }\r\n    }\r\n);\r\n```\r\n\r\n## Installation\r\n\r\n```shell\r\n$ cordova plugin add cordova-plugin-file-opener2\r\n```\r\n\r\n### Optional variables\r\n\r\nThis plugin requires the Android support library v4. From release `2.1.0` the version of this can be set at installation. The minimum version is `24.1.0`. Default value is `27.+`. [Check out the latest version](https://developer.android.com/topic/libraries/support-library/revisions.html).\r\n\r\n```shell\r\n$ cordova plugin add cordova-plugin-file-opener2  --variable ANDROID_SUPPORT_V4_VERSION=\"27.+\"\r\n```\r\n\r\nIf you are using the `cordova-android-support-gradle-release` plugin it should match the value you have set there.\r\n\r\n## Requirements\r\n\r\nThe following platforms and versions are supported by the latest release:\r\n\r\n- Android 4.4+ / iOS 9+ / Windows / Electron\r\n- Cordova CLI 7.0 or higher\r\n\r\nCordova CLI 6.0 is supported by 2.0.19, but there are a number of issues, particularly with Android builds (see [232](https://github.com/pwlin/cordova-plugin-file-opener2/issues/232) [203](https://github.com/pwlin/cordova-plugin-file-opener2/issues/203) [207](https://github.com/pwlin/cordova-plugin-file-opener2/issues/207)). Using the [cordova-android-support-gradle-release](https://github.com/dpa99c/cordova-android-support-gradle-release) plugin may help.\r\n\r\n### AndroidX Support\r\n\r\nCurrently if your project requires AndroidX support, you need to add the following two plugins to your project:\r\n\r\n- [cordova-plugin-androidx](https://github.com/dpa99c/cordova-plugin-androidx/) and [cordova-plugin-androidx-adapter](https://github.com/dpa99c/cordova-plugin-androidx-adapter/)\r\n```shell\r\n$ cordova plugin add cordova-plugin-androidx\r\n$ cordova plugin add cordova-plugin-androidx-adapter\r\n```\r\nJust adding these plugins should be enough and no further changes are necessary.\r\n\r\n\r\n## fileOpener2.open(filePath, mimeType, options)\r\n\r\nOpens a file\r\n\r\n### Supported Platforms\r\n\r\n- Android 4.4+\r\n- iOS 9+\r\n- Windows\r\n- Electron\r\n\r\n### Quick Examples\r\nOpen an APK install dialog:\r\n\r\n```javascript\r\ncordova.plugins.fileOpener2.open(\r\n    '/Downloads/gmail.apk',\r\n    'application/vnd.android.package-archive'\r\n);\r\n```\r\n\r\nOpen a PDF document with the default PDF reader and optional callback object:\r\n\r\n```js\r\ncordova.plugins.fileOpener2.open(\r\n    '/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Downloads/starwars.pdf\r\n    'application/pdf',\r\n    {\r\n        error : function(e) {\r\n            console.log('Error status: ' + e.status + ' - Error message: ' + e.message);\r\n        },\r\n        success : function () {\r\n            console.log('file opened successfully');\r\n        }\r\n    }\r\n);\r\n```\r\n\r\n__Note on Electron:__ Do not forget to enable Node.js in your app by adding `\"nodeIntegration\": true` to `platforms/electron/platform_www/cdv-electron-settings.json` file, See [Cordova-Electron documentation](https://cordova.apache.org/docs/en/latest/guide/platforms/electron/index.html#customizing-the-application's-window-options).\r\n\r\n### Market place installation\r\nInstall From Market: to install an APK from a market place, such as Google Play or the App Store, you can use an `<a>` tag in combination with the `market://` protocol:\r\n\r\n```html\r\n<a href=\"market://details?id=xxxx\" target=\"_system\">Install from Google Play</a>\r\n<a href=\"itms-apps://itunes.apple.com/app/my-app/idxxxxxxxx?mt=8\" target=\"_system\">Install from App Store</a>\r\n```\r\nor in code:\r\n\r\n```js\r\nwindow.open(\"[market:// or itms-apps:// link]\",\"_system\");\r\n```\r\n\r\n## fileOpener2.showOpenWithDialog(filePath, mimeType, options)\r\n\r\nOpens with system modal to open file with an already installed app.\r\n\r\n### Supported Platforms\r\n\r\n- Android 4.4+\r\n- iOS 9+\r\n\r\n### Quick Example\r\n\r\n```js\r\ncordova.plugins.fileOpener2.showOpenWithDialog(\r\n    '/Downloads/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Downloads/starwars.pdf\r\n    'application/pdf',\r\n    {\r\n        error : function(e) {\r\n            console.log('Error status: ' + e.status + ' - Error message: ' + e.message);\r\n        },\r\n        success : function () {\r\n            console.log('file opened successfully');\r\n        },\r\n        position : [0, 0]\r\n    }\r\n);\r\n```\r\n`position` array of coordinates from top-left device screen, use for iOS dialog positioning.\r\n\r\n## fileOpener2.uninstall(packageId, callbackContext)\r\n\r\nUninstall a package with its ID. \r\n\r\n__Note__: You need to add `<uses-permission android:name=\"android.permission.REQUEST_DELETE_PACKAGES\" />` to your `AndroidManifest.xml`\r\n\r\n### Supported Platforms\r\n\r\n- Android 4.4+\r\n\r\n### Quick Example\r\n```js\r\ncordova.plugins.fileOpener2.uninstall('com.zynga.FarmVille2CountryEscape', {\r\n    error : function(e) {\r\n        console.log('Error status: ' + e.status + ' - Error message: ' + e.message);\r\n    },\r\n    success : function() {\r\n        console.log('Uninstall intent activity started.');\r\n    }\r\n});\r\n```\r\n\r\n## fileOpener2.appIsInstalled(packageId, callbackContext)\r\n\r\nCheck if an app is already installed.\r\n\r\n### Supported Platforms\r\n\r\n- Android 4.4+\r\n\r\n### Quick Example\r\n```javascript\r\ncordova.plugins.fileOpener2.appIsInstalled('com.adobe.reader', {\r\n    success : function(res) {\r\n        if (res.status === 0) {\r\n            console.log('Adobe Reader is not installed.');\r\n        } else {\r\n            console.log('Adobe Reader is installed.')\r\n        }\r\n    }\r\n});\r\n```\r\n---\r\n\r\n## Android APK installation limitation\r\n\r\nThe following limitations apply when opening an APK file for installation:\r\n- On Android 8+, your application must have the `ACTION_INSTALL_PACKAGE` permission. You can add it by adding this to your app's `config.xml` file:\r\n```xml\r\n<platform name=\"android\">\r\n    <config-file parent=\"/manifest\" target=\"AndroidManifest.xml\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\r\n        <uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\" />\r\n    </config-file>\r\n</platform>\r\n```\r\n\r\n- Before Android 7, you can only install APKs from the \"external\" partition. For example, you can install from `cordova.file.externalDataDirectory`, but **not** from `cordova.file.dataDirectory`. Android 7+ does not have this limitation.\r\n\r\n---\r\n\r\n## SD card limitation on Android\r\n\r\nIt is not always possible to open a file from the SD Card using this plugin on Android. This is because the underlying  Android library used [does not support serving files from secondary external storage devices](https://stackoverflow.com/questions/40318116/fileprovider-and-secondary-external-storage). Whether or not your the SD card is treated as a secondary external device depends on your particular phone's set up.\r\n\r\n---\r\n\r\n## Notes\r\n\r\n- For properly opening _any_ file, you must already have a suitable reader for that particular file type installed on your device. Otherwise this will not work.\r\n\r\n- [It is reported](https://github.com/pwlin/cordova-plugin-file-opener2/issues/2#issuecomment-41295793) that in iOS, you might need to remove `<preference name=\"iosPersistentFileLocation\" value=\"Library\" />` from your `config.xml`\r\n\r\n- If you are wondering what MIME-type should you pass as the second argument to `open` function, [here is a list of all known MIME-types](http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=co)\r\n\r\n\r\n---\r\n\r\n\r\n","readmeFilename":"README.md"}