android recommend to a friend feature in android application
I want to add a "recommend to a friend" featu开发者_运维百科re in my Android application. Can anyone help me how to do this?
public void recommendToFriend() {
String emailTo = "";
String emailCC = "";
String defaultSubject = "MySuper Android application";
String body = "http://market.android.com/details?id=" + getPackageName();
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { emailTo });
intent.putExtra(Intent.EXTRA_CC, new String[] { emailCC });
intent.putExtra(Intent.EXTRA_SUBJECT, defaultSubject);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, body);
startActivity(Intent.createChooser(intent, getString(R.string.recommend_to_a_friend)));
}
In your app, you can have any kind of control, like Button, Hyperlink, or dialog etc to implement this feature...
精彩评论