繁体   English   中英

如何获取Android设备中所有已安装应用程序的apk列表

[英]How to get list of apk of all installed app in android device

apk文件在android设备中存储在哪里以及如何获取所有已安装应用程序的apk列表

没有 root 权限,您无法获取 apk 文件,并且由于安全问题,如果您要共享 APK 文件也不是一个好主意。

唯一好的做法是获取应用程序 ID,然后使用App linking生成具有特定包名称的App store Intent 链接,就像您想要从浏览器启动应用程序时所做的那样。 类似的东西在这里应用程序从浏览器打开

这是获取已安装应用程序列表的方法

Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> appList = context.getPackageManager().queryIntentActivities( intent, 0);

共享也可能如下所示:

fun shareApp(appId: String, activity: Activity) {
        ShareCompat.IntentBuilder.from(activity)
                .setType("text/plain")
                .setChooserTitle("Share app")
                .setText("http://play.google.com/store/apps/details?id=" + appId)
                .startChooser()
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM