-
Notifications
You must be signed in to change notification settings - Fork 17
My expansion APK reader plugin. #14
Description
Hi moust, psyon. I took some of your base code concepts and made a new plugin.
https://github.com/agamemnus/cordova-plugin-xapkreader
It's almost entirely automated. You just need to modify the XML data and the provider's android:authorities string (in android.json, if rebuilding), and that's it. There's no need to modify any of the java files.
It just uses the content provider URI, no functions.
One big technical problem I had to overcome is getting the version (and other) data into the file reader before it was read. As you probably know, the file reader is run by the content provider before the XAPKReader has a chance to do anything. To solve that, I overrode openAssetFile in XAPKProvider to throw a FileNotFoundException if the version data wasn't sent over the XAPKProvider yet. When the XAPKReader runs, it populates that data and then runs openAssetFile via the webView's openForRead.
You'll find a number of other improvements:
- It should accept separate main and patch file versions now. (not tested)
- It should allow you to ignore the file size checks with some boolean switches.
- The public key data and the text data are all loaded in programmatically from the xml file. No need for .R file linkage.
- I included the needed Android SDK libraries, already compiled.