moust / phonegap-xapkreader

Cordova plugin to access files in APK Expansion Files
13 stars 17 forks source link

My expansion APK reader plugin. #14

Open agamemnus opened 10 years ago

agamemnus commented 10 years ago

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:

moust commented 10 years ago

It sounds interesting. I will take a look on your fork when I would have the time. It will probably inspire me to improve my own plugin. :)

agamemnus commented 10 years ago

Well, it's not a fork... I forgot to add the link. Adding it to the first post now.

I made some more changes. All you have to do now is to add the public key and change the content provider in the AndroidManifest.xml file and in the xapkreader.xml file. (or in plugins/android.json)