2

I'm working on a simple app and need to add share feature to it. I just need to share result of the game on FB, Twitter and G+. If anyone can help, how can I implement this into my app? Thanks in advance..

gtboy
  • 128
  • 1
  • 3
  • 12
  • "I just need to share result of the game on FB, Twitter and G+" -- what if the user wants to share the results somewhere else? Use `ACTION_SEND` and allow the *user* to decide where the *user* wants the *user's* game results to be shared. – CommonsWare Mar 16 '12 at 19:56

2 Answers2

2

You can try something like this. Usually, FB, Twitter, and Google+ listen to share event

public void share() {
    Intent i = null;
    String msg ="Something to share about"

    i = new Intent(Intent.ACTION_SEND);
    i.setType("text/plain");

    i.putExtra(Intent.EXTRA_TEXT, msg);
    i.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.sharing_sbj) + " \""
            + "Share title"+ "\" : " + getResources().getString(R.string.app_name));

    startActivity(Intent.createChooser(i, this.getString(R.string.sending_to)));
}
Win Myo Htet
  • 5,377
  • 3
  • 38
  • 56
1

As we don't have any code, the main thing to share text on installed Applications (Facebook and Twitter) is here :

Android App - Share Facebook Twitter

Else, you will have to use specific API to share more informations.


You can try to check on Google+ API to know how to include it in Android app as i never tried it :

https://developers.google.com/+/api/

ChapMic
  • 26,954
  • 1
  • 21
  • 20
  • With this code, you can share a text with all the social applicactions the movile have installed.If you want to share anything with FB, Twitter or G+ ever if the user hasn't the apps installed, you must use specific API for each site. – Daniel Argüelles Mar 16 '12 at 19:44