开发者

Identifying the market category of an installed app

If you the ApplicationInfo of a installed app, is there a way you can find out what its market categ开发者_如何学Goory is?


The ApplicationInfo will only provided information related to the apps manifest (packagename,appname,icon,.....). You won't be able to retrieve Market data for that app.

Market specific items like price,market category,feature graphic cannot be retrieved using the Android SDK.

There are "unofficial" third party APIs available to do this. ex: http://code.google.com/p/android-market-api/


If you just want a dirty way, here is my php code:

<?
$package_name = "com.devbro.appdrawer";
$content = file_get_contents('https://play.google.com/stor/apps/details?id='.$package_name);

preg_match_all("|/store/apps/category/(.*)\?feature=category-nav|U",$content,$out,PREG_PATTERN_ORDER);
echo $out[1][0];


The ApplicationInfo only returns information collected from the AndroidManifest.xml's <application> tag.

What you are trying to access is Google Play Store specific information, something the developer specifies once publishing an app from his/her developer's account dashboard. Please also note the "category" can be changed anytime later...

To get the category of an app you need to get that data from Google Play itself. For instance, you could develop your own HTML crawler, parse the page and extract the app "category". This topic has been covered in other questions, for example here.

If you don't want to implement all that by yourself, you could use a third-party service to access Android apps meta-data through a JSON-based API.

For instance, 42matters.com (the company I work for) offers a unified API for both Android and iOS, here more details:

https://42matters.com/app-market-data

With the "lookup" endpoint you could ask for a specific Android app meta-data by specifying it's "package name" (i.e. its identifier). In the JSON response it will be returned the "category" as you find on Google Play.

I hope this helps :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜