开发者

Get Application information from an APK using PHP script

How can I get the versionCode, versionName, application icon and application label from an APK w开发者_如何学Cith PHP


I'm not that familiar with php so I can't provide any code, but the idea is:

  • unzip the APK file (since it's "nomal" zip format)
  • open the AndroidManifest.xml and
  • parse the <manifest> tag for android:versionCode and android:versionName


If I'm not wrong, APKs are simply zip files. And android packages will have some sort of XML file that will mention the version information.

In PHP, you can unzip as well as read XMLs.


As you might know an APK is a simple zip formated archive with it's metadata in XML format.

Try and unzip some apks and see which files have the information you need.

This can all be easily done in PHP.


Well,

It is correct that the apk is in fact a zip-file and that is easy to unzip. However the manifest xml is not in standard xml format. It is some kind of propitiatory Android format.

You can use apktool to unpack the xml, but it is in Java and not very fun if you don't have Java on the server.

There is also a Python Library available, AXMLParsePY

Then we have AXmlPrinter2, also written in Java

I am myself looking for a PHP library and have given up. Now looking for something lightweight I can convert from some other language.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜