mirror of
https://gitee.com/shuto/cordova-plugin-file-opener2.git
synced 2025-01-31 12:02:49 +08:00
Bumped the version to 2.0.0 - Added more Contributors to README.md
This commit is contained in:
parent
6946144296
commit
15f69c085c
227
README.md
227
README.md
@ -1,108 +1,119 @@
|
|||||||
A File Opener Plugin for Cordova (The Original Version)
|
Contributors
|
||||||
==========================
|
------------
|
||||||
This plugin will open a file on your device file system with its default application.
|
[@Gillardo](https://github.com/Gillardo/)
|
||||||
|
|
||||||
Requirements
|
[@TankOs](https://github.com/TankOs)
|
||||||
-------------
|
|
||||||
- Android 4 or higher / iOS 6 or higher / WP8
|
[@Rovi23](https://github.com/Rovi23)
|
||||||
- Cordova 3.0 or higher
|
|
||||||
|
[@josemanuelbd](https://github.com/josemanuelbd)
|
||||||
Installation
|
|
||||||
-------------
|
|
||||||
cordova plugin add https://github.com/pwlin/cordova-plugin-file-opener2
|
A File Opener Plugin for Cordova (The Original Version)
|
||||||
|
==========================
|
||||||
PhoneGap Build
|
This plugin will open a file on your device file system with its default application.
|
||||||
---------------
|
|
||||||
This Plugin is also available in PhoneGap Build Repository. Go to [https://build.phonegap.com/](https://build.phonegap.com/)
|
Requirements
|
||||||
And search for `io.github.pwlin.cordova.plugins.fileopener2`
|
-------------
|
||||||
(There are a couple of other forks out there which are mostly out of date. Make sure to download the one with the exact same id as mentioned above)
|
- Android 4 or higher / iOS 6 or higher / WP8
|
||||||
|
- Cordova 3.0 or higher
|
||||||
|
|
||||||
Usage
|
Installation
|
||||||
------
|
-------------
|
||||||
Open an APK install dialog:
|
cordova plugin add cordova-plugin-file-opener2
|
||||||
|
|
||||||
cordova.plugins.fileOpener2.open(
|
Usage
|
||||||
'/sdcard/Download/gmail.apk',
|
------
|
||||||
'application/vnd.android.package-archive'
|
cordova.plugins.fileOpener2.open(
|
||||||
);
|
filePath,
|
||||||
|
fileType,
|
||||||
Open a PDF document with the default PDF reader and optional callback object:
|
{
|
||||||
|
error : function(){ },
|
||||||
cordova.plugins.fileOpener2.open(
|
success : function(){ }
|
||||||
'/sdcard/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Download/starwars.pdf
|
}
|
||||||
'application/pdf',
|
);
|
||||||
{
|
|
||||||
error : function(e) {
|
Examples
|
||||||
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
|
--------
|
||||||
},
|
Open an APK install dialog:
|
||||||
success : function () {
|
|
||||||
console.log('file opened successfully');
|
cordova.plugins.fileOpener2.open(
|
||||||
}
|
'/sdcard/Download/gmail.apk',
|
||||||
}
|
'application/vnd.android.package-archive'
|
||||||
);
|
);
|
||||||
|
|
||||||
Notes
|
Open a PDF document with the default PDF reader and optional callback object:
|
||||||
------
|
|
||||||
|
cordova.plugins.fileOpener2.open(
|
||||||
- For properly opening a PDF file, you must already have a PDF reader (Acrobat Reader, Foxit Mobile PDF, etc. ) installed on your mobile device. Otherwise this will not work
|
'/sdcard/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Download/starwars.pdf
|
||||||
|
'application/pdf',
|
||||||
|
{
|
||||||
- [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`
|
error : function(e) {
|
||||||
|
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
|
||||||
|
},
|
||||||
Additional Android Functions
|
success : function () {
|
||||||
-----------------------------
|
console.log('file opened successfully');
|
||||||
####The following functions are available in Android platform
|
}
|
||||||
|
}
|
||||||
###.uninstall(_packageId, callbackContext_)
|
);
|
||||||
Uninstall a package with its id.
|
|
||||||
|
Notes
|
||||||
cordova.plugins.fileOpener2.uninstall('com.zynga.FarmVille2CountryEscape', {
|
------
|
||||||
error : function(e) {
|
|
||||||
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
|
- For properly opening a any file, you must already have an suitable reader for that particular file type already installed on your device. Otherwise this will not work.
|
||||||
},
|
|
||||||
success : function() {
|
|
||||||
console.log('Uninstall intent activity started.');
|
- [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`
|
||||||
}
|
|
||||||
});
|
|
||||||
|
Additional Android Functions
|
||||||
###.appIsInstalled(_packageId, callbackContext_)
|
-----------------------------
|
||||||
Check if an app is already installed.
|
####The following functions are available in Android platform
|
||||||
|
|
||||||
cordova.plugins.fileOpener2.appIsInstalled('com.adobe.reader', {
|
###.uninstall(_packageId, callbackContext_)
|
||||||
success : function(res) {
|
Uninstall a package with its id.
|
||||||
if (res.status === 0) {
|
|
||||||
console.log('Adobe Reader is not installed.');
|
cordova.plugins.fileOpener2.uninstall('com.zynga.FarmVille2CountryEscape', {
|
||||||
} else {
|
error : function(e) {
|
||||||
console.log('Adobe Reader is installed.')
|
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
|
||||||
}
|
},
|
||||||
}
|
success : function() {
|
||||||
});
|
console.log('Uninstall intent activity started.');
|
||||||
|
}
|
||||||
Contributors
|
});
|
||||||
------------
|
|
||||||
[@Gillardo:](https://github.com/Gillardo/) Support for WP8
|
###.appIsInstalled(_packageId, callbackContext_)
|
||||||
|
Check if an app is already installed.
|
||||||
LICENSE
|
|
||||||
--------
|
cordova.plugins.fileOpener2.appIsInstalled('com.adobe.reader', {
|
||||||
The MIT License (MIT)
|
success : function(res) {
|
||||||
|
if (res.status === 0) {
|
||||||
Copyright (c) 2013 pwlin - pwlin05@gmail.com
|
console.log('Adobe Reader is not installed.');
|
||||||
|
} else {
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
console.log('Adobe Reader is installed.')
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
}
|
||||||
the Software without restriction, including without limitation the rights to
|
}
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
});
|
||||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
LICENSE
|
||||||
|
--------
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The MIT License (MIT)
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
Copyright (c) 2013 pwlin - pwlin05@gmail.com
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
the Software without restriction, including without limitation the rights to
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
39
package.json
Normal file
39
package.json
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "cordova-plugin-file-opener2",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"description": "A File Opener Plugin for Cordova. (The Original Version)",
|
||||||
|
"cordova": {
|
||||||
|
"id": "cordova-plugin-file-opener2",
|
||||||
|
"platforms": [
|
||||||
|
"android",
|
||||||
|
"ios",
|
||||||
|
"wp8",
|
||||||
|
"windows"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/pwlin/cordova-plugin-file-opener2.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"ecosystem:cordova",
|
||||||
|
"cordova-android",
|
||||||
|
"cordova-ios",
|
||||||
|
"cordova-wp8",
|
||||||
|
"cordova-windows"
|
||||||
|
],
|
||||||
|
"engines": [
|
||||||
|
{
|
||||||
|
"name": "cordova",
|
||||||
|
"version": ">=3.0.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"author": {
|
||||||
|
"name": "pwlin05@gmail.com"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/pwlin/cordova-plugin-file-opener2/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/pwlin/cordova-plugin-file-opener2#readme"
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-file-opener2" version="1.0.11">
|
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-file-opener2" version="2.0.0">
|
||||||
|
|
||||||
<name>File Opener2</name>
|
<name>File Opener2</name>
|
||||||
<description>A File Opener Plugin for Cordova. (The Original Version)</description>
|
<description>A File Opener Plugin for Cordova. (The Original Version)</description>
|
||||||
|
Loading…
Reference in New Issue
Block a user