在 android 中分享应用功能
Share app feature in android
如何在 android 中实现 'Share App' 功能。我看了很多网站,但都展示了如何共享文件、多媒体等。但是没有适当的代码来共享应用程序本身。谁能帮帮我?
您可以使用下面的代码
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();
}
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();
}
如何在 android 中实现 'Share App' 功能。我看了很多网站,但都展示了如何共享文件、多媒体等。但是没有适当的代码来共享应用程序本身。谁能帮帮我?
您可以使用下面的代码
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();
}
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();
}