我想收获一些特定应用程序的数据android-market检索空的结果
Google play marketplace。
我已经使用这个非官方的API:
https://code.google.com/p/android-market-api/
这里是我的代码,基本上得到的应用程序的名字
,并尝试在每个应用程序获取其他数据列表:
public void printAllAppsData(ArrayList<AppHarvestedData> dataWithAppsNamesOnly)
{
MarketSession session = new MarketSession();
session.login("[myGamil]","[myPassword]");
session.getContext().setAndroidId("dead00beef");
final ArrayList<AppHarvestedData> finalResults = new ArrayList<AppHarvestedData>();
for (AppHarvestedData r : dataWithAppsNamesOnly)
{
String query = r.name;
AppsRequest appsRequest = AppsRequest.newBuilder()
.setQuery(query)
.setStartIndex(0).setEntriesCount(10)
//.setCategoryId("SOCIAL")
.setWithExtendedInfo(true)
.build();
session.append(appsRequest, new Callback<AppsResponse>() {
@Override
public void onResult(ResponseContext context, AppsResponse response) {
List<App> apps = response.getAppList();
for (App app : apps) {
AppHarvestedData r = new AppHarvestedData();
r.title = app.getTitle();
r.description = app.getExtendedInfo().getDescription();
String tmp = app.getExtendedInfo().getDownloadsCountText();
tmp = tmp.replace('<',' ').replace('>',' ');
int indexOf = tmp.indexOf("-");
tmp = (indexOf == -1) ? tmp : tmp.substring(0, indexOf);
r.downloads = tmp.trim();
r.rating = app.getRating();
r.version = app.getVersion();
r.userRatingCount = String.valueOf(app.getRatingsCount());
finalResults.add(r);
}
}
});
session.flush();
}
for(AppHarvestedData res : finalResults)
{
System.out.println(res.toString());
}
}
}
我应该再打一次电话session.flush();
在这一点上?
我所有的quesries空车返回集合作为一个结果,
即使我看到有一些名字作为输入。
当我只发送一个硬编码的应用程序名称作为查询时,它工作正常。
这种方式是不是有效 如果你有你的AppId应该使用该查询。它不是官方API,开发人员可以多次更改或更新,因此您需要多次更改代码或方法。我用这个非官方的API创建了一个应用程序,第一次运行良好,然后在1个月后崩溃,并再次开始工作,然后再次崩溃。此API可以检索关于市场上所有应用程序的信息。我认为开发人员拥有自己的数据库,并在需要时进行更新。我决定不使用这个API。 – Daryn 2013-11-22 09:42:30