Wie kann ich "Share App" -Funktion in Android implementieren. Ich habe viele Websites gesehen, aber alle zeigen, wie man Dateien, Multimedia usw. teilt. Aber es gibt keinen richtigen Code für die Freigabe der App selbst. Kann mir bitte jemand helfen?Share App-Funktion in Android
0
A
Antwort
4
können Sie unter Code verwenden
try
{ Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "My application name");
String sAux = "\nLet me recommend you this application\n\n";
sAux = sAux + "https://play.google.com/store/apps/details?id=Orion.Soft \n\n";
i.putExtra(Intent.EXTRA_TEXT, sAux);
startActivity(Intent.createChooser(i, "choose one"));
}
catch(Exception e)
{ //e.toString();
}
0
You can try the below code for sharing your application :
try {
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "Your app name");
String s = "\n Your app recommendation text here\n\n";
s = s + "Your string to mention here(may be playstore url)";
i.putExtra(Intent.EXTRA_TEXT, sAux);
mActivity.startActivity(Intent.createChooser(i, "choose to share"));
} catch(Exception e) {
//e.toString();
e.printStackTrace();
}
bessere Nutzung BuildConfig.APPLICATION_ID statt Hardcoding. Auch keine echte Notwendigkeit für eine Auswahl hier – ligi
@Krishna Vielen Dank – PersianBlue