Share App:-
ShareApp = view.findViewById(R.id.shareApp);
ShareApp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "My application name");
String s = "\n Just clicked & install this application:\n\n";
s = s + "https://play.google.com/store/apps/details?id=org.halalscan.jss\n\n";
i.putExtra(Intent.EXTRA_TEXT, sAux);
startActivity(Intent.createChooser(i, "Choose One"));
} catch (Exception e) {
e.printStackTrace();
}
}
});
Share Apk:-
ShareApk.setOnClickListener(new View.OnClickListener() {@Override
public void onClick(View view) {
ApplicationInfo app = getActivity().getApplicationInfo();
String filePath = app.sourceDir;
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("application/your package name");
// Append file and send Intent
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(filePath)));
startActivity(Intent.createChooser(intent, "Share app using"));
}
});
Tag:- share app, app sharing in android, apk share in android, share intent in android, android.
Comments
Post a Comment
Please comment here if you have any query.