I am trying to send apk through application which have capability to send applications, I tested all the answers but I get this toast message. the file format is not supported,,,,
this is my the code that I have test
public void shareApp() {
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("application/vnd.android.package-archive");
Uri path = Uri.parse("/data/apps/"+getActivity().getApplicationContext().getPackageName()+".apk");
i.putExtra(Intent.EXTRA_SUBJECT, "Here is the fancy app");
i.putExtra(Intent.EXTRA_TEXT, "Don't miss it!");
i.putExtra(Intent.EXTRA_STREAM, path);
try {
startActivity(Intent.createChooser(i, "Share via"));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(getContext(), "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}}