简体   繁体   English

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

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

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

You can not get apk file without root permission and if you would share APK file would not be good idea because of security issues.没有 root 权限,您无法获取 apk 文件,并且由于安全问题,如果您要共享 APK 文件也不是一个好主意。

Only good practice option is get app id and then generate Intent link to App store with specific package name using App linking like you are doing when want to start app from browser.唯一好的做法是获取应用程序 ID,然后使用App linking生成具有特定包名称的App store Intent 链接,就像您想要从浏览器启动应用程序时所做的那样。 something similar is here App opening from browser类似的东西在这里应用程序从浏览器打开

And here is how you can get installed apps list这是获取已安装应用程序列表的方法

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

sharing might also look like this:共享也可能如下所示:

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