我可以在手机上获取已安装应用程序的 APK 文件吗
问题描述:
我正在尝试开发用于备份文件的应用程序.我需要像 Astro 管理器那样提取已安装应用程序的 APK 文件.
I am trying to develop a application for backing up the files. I need to extract the APK files of installed applications like the Astro manager does.
如果有人知道如何提取,请给我解决方案.
If anyone know how to extract please give me the solution.
答
它们存储在 /data/app/
中,但除非您的手机已 root,否则您将看不到任何内容.
They are stored in /data/app/
but unless your phone is rooted you won't see anything there.
系统 apk 存储在 /system/app
System apk's are stored at /system/app
获得确切 apk 路径的更好方法:
A better way of getting the exact apk path :
PackageManager pm = getPackageManager();
List<PackageInfo> pkginfolist = pm.getInstalledPackages(PackageManager.GET_ACTIVITIES);
List<ApplicationInfo> appinfoList = pm.getInstalledApplications(0);
for (int x = 0; x < pkginfolist .size(); x++) {
PackageInfo pkginfo = pkginfolist.get(x);
pkg_path[x] = appinfoList.get(x).publicSourceDir;
}