gpt4 book ai didi

java - 通过 Play 商店的 Android 应用类别

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:09:00 25 4
gpt4 key购买 nike

我想构建一个安装在我的 Android 设备上的应用程序列表。我也想将我的应用程序的使用类别保存在我的列表中。

举个例子。我可以看到我有多少“游戏”应用等。

我的设备中已经安装了 Android 应用程序列表,现在我需要这些类别。

我的第一个方法是使用 appaware.com,但我的目标是使用官方游戏商店。

除了扫描网站之外,您是否知道我可以如何使用它。您知道 Java 或 JavaScript 中的任何非官方 API 还是隐藏的官方 API?

so what i have: - a list of all my apps (incl. package etc.)
what i need: an API to get the categories of the apps :-)

感谢您的回答。

最佳答案

我也遇到了同样的问题。上述查询的解决方案如下。

首先,下载Jsoup库或下载jar文件。

或将此添加到您的 build.gradle(Module: app) 实现 'org.jsoup:jsoup:1.11.3'

private class FetchCategoryTask extends AsyncTask<Void, Void, Void> {

private final String TAG = FetchCategoryTask.class.getSimpleName();
private PackageManager pm;
//private ActivityUtil mActivityUtil;

@Override
protected Void doInBackground(Void... errors) {
String category;
pm = getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
Iterator<ApplicationInfo> iterator = packages.iterator();
// while (iterator.hasNext()) {
// ApplicationInfo packageInfo = iterator.next();
String query_url = "https://play.google.com/store/apps/details?id=com.imo.android.imoim"; //GOOGLE_URL + packageInfo.packageName;
Log.i(TAG, query_url);
category = getCategory(query_url);
Log.e("CATEGORY", category);

// store category or do something else
//}
return null;
}


private String getCategory(String query_url) {

try {
Document doc = Jsoup.connect(query_url).get();
Elements link = doc.select("a[class=\"hrTbp R8zArc\"]");
return link.text();
} catch (Exception e) {
Log.e("DOc", e.toString());
}
}
}

作为返回,您将获得应用程序公司名称和应用程序类别

关于java - 通过 Play 商店的 Android 应用类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16787540/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com