0

How to share Apk files directly from your android application when users click on the share button and all sharing sites will be open &share Apk files ??

Arsalan Arain
  • 11
  • 1
  • 3
  • The answer was existed here https://stackoverflow.com/questions/37984988/how-to-send-apk-using-share-intent-programatically-in-android && here https://stackoverflow.com/questions/21816382/packing-my-app-and-share-to-other-android – Reda El-hadidy Feb 17 '21 at 08:08

1 Answers1

0
ApplicationInfo api = getApplicationContext().getApplicationInfo();
String apkPath = api.sourceDir;
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("application/vnd.android.package-archive");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(apkPath)));
startActivity(Intent.createChooser(intent, "Share Via"));
סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68