views:

441

answers:

1

I am trying to create PHP script to get app version from Android APK file. Extracting xml file from APK (zip) file and then parsing XML is one way, but i guess it should be simpler. Something like PHP Manual, example #3. Any ideas how to create script?

+2  A: 

If you have the Android SDK installed on the server, you can use PHP's exec (or similar) to execute the aapt tool (in $ANDROID_HOME/platforms/android-X/tools).

$ aapt dump badging myapp.apk
package: name='com.example.myapp' versionCode='1530' versionName='1.5.3'

If you can't install the Android SDK, for whatever reason, then you will need to parse Android's binary XML format. The AndroidManifest.xml file inside the APK zip structure is not plain text.

You would need to port a utility like AXMLParser from Java to PHP.

Christopher
Without Android SDK on server, with PHP script. I am looking in for solution like in link I posted (example #3)
Solata
I updated my answer.
Christopher