Merge pull request #234 from shnist/master

Add optional android version support variable at installation
This commit is contained in:
Aaron Faber 2018-12-10 16:25:19 +00:00 committed by GitHub
commit ad4739eb67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 19 deletions

View File

@ -17,17 +17,18 @@ Requirements
Installation Installation
------------- -------------
cordova plugin add cordova-plugin-file-opener2 $ cordova plugin add cordova-plugin-file-opener2
$ cordova plugin add cordova-plugin-file-opener2 --variable ANDROID_SUPPORT_VERSION={required version}
Usage Usage
------ ------
cordova.plugins.fileOpener2.open( cordova.plugins.fileOpener2.open(
filePath, filePath,
fileMIMEType, fileMIMEType,
{ {
error : function(){ }, error : function(){ },
success : function(){ } success : function(){ }
} }
); );
Examples Examples
@ -35,21 +36,21 @@ Examples
Open an APK install dialog: Open an APK install dialog:
cordova.plugins.fileOpener2.open( cordova.plugins.fileOpener2.open(
'/sdcard/Download/gmail.apk', '/sdcard/Download/gmail.apk',
'application/vnd.android.package-archive' 'application/vnd.android.package-archive'
); );
Open a PDF document with the default PDF reader and optional callback object: Open a PDF document with the default PDF reader and optional callback object:
cordova.plugins.fileOpener2.open( cordova.plugins.fileOpener2.open(
'/sdcard/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Download/starwars.pdf '/sdcard/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Download/starwars.pdf
'application/pdf', 'application/pdf',
{ {
error : function(e) { error : function(e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message); console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
}, },
success : function () { success : function () {
console.log('file opened successfully'); console.log('file opened successfully');
} }
} }
); );
@ -58,13 +59,13 @@ Open a system modal to open PDF document with one of the already installed app a
cordova.plugins.fileOpener2.showOpenWithDialog( cordova.plugins.fileOpener2.showOpenWithDialog(
'/sdcard/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Download/starwars.pdf '/sdcard/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Download/starwars.pdf
'application/pdf', 'application/pdf',
{ {
error : function(e) { error : function(e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message); console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
}, },
success : function () { success : function () {
console.log('file opened successfully'); console.log('file opened successfully');
} }
} }
); );
@ -102,7 +103,7 @@ Uninstall a package with its id.
cordova.plugins.fileOpener2.uninstall('com.zynga.FarmVille2CountryEscape', { cordova.plugins.fileOpener2.uninstall('com.zynga.FarmVille2CountryEscape', {
error : function(e) { error : function(e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message); console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
}, },
success : function() { success : function() {
console.log('Uninstall intent activity started.'); console.log('Uninstall intent activity started.');

View File

@ -31,7 +31,8 @@
</provider> </provider>
</config-file> </config-file>
<source-file src="src/android/res/xml/opener_paths.xml" target-dir="res/xml" /> <source-file src="src/android/res/xml/opener_paths.xml" target-dir="res/xml" />
<framework src="com.android.support:support-v4:+" /> <preference name="ANDROID_SUPPORT_V4_VERSION" default="27.+"/>
<framework src="com.android.support:support-v4:$ANDROID_SUPPORT_V4_VERSION"/>
</platform> </platform>
<!-- iOS --> <!-- iOS -->