分享也是很关键的一个功能,正因为,你的app存在的市场比较少,使用者给其他人推荐的时候可能对方并不能在自带的市场搜索到。
所以最好集成上。
如果你比较懒,也可以加一个分享apk的功能,也没问题:
#伪代码
public static void shareFile(Context context) {
File apkFile = AppUtils.getApkFile(context);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(apkFile));
context.startActivity(intent);
}
/** * Created by DELL zhanghuirong on 2020/7/10. */ public class AppUtils { public static File getApkFile(Context context) { // 获取当前程序路径 String absolutePath = context.getFilesDir().getAbsolutePath(); //获取安装包路径 String packageResourcePath = context.getApplicationContext().getPackageResourcePath(); File file = new File(packageResourcePath); return file; } }
这样就可以将apk分享给别人了。