我想在意图中添加 .apk 文件。我想创建一个“共享”按钮,它将通过蓝牙或任何其他能够发送应用程序的应用程序共享整个应用程序。如果可以通过其他方式完成此操作,请告诉我!
谢谢
List(ApplicationInfo) mAppList=getPackageManager().getInstalledApplications(0);
ApplicationInfo item = mAppList.get(position);
public static void ShareAPK(ApplicationInfo item,Context ctx) {
try {
File srcFile = new File(item.publicSourceDir);
Intent share = new Intent();
share.setAction(Intent.ACTION_SEND);
share.setType("application/vnd.android.package-archive");
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(srcFile));
ctx.startActivity(Intent.createChooser(share, "Sharing"));
} catch (Exception e) {
e.printtrace();
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)