FR073N
FR073N

Reputation: 2091

Sharing highscore screenshot in social media Android

I am developing a game, and I would like to how to send a message and a screenshot to social media while the user will log into his account.

So I have many options:

  1. I use a code like this one to take a screenshot of the current highscore of the user. But the problem is how could I send this picture to social media? Is there a way to send a picture while logging into facebook/twitter?

  2. I read that I could use the facebook APK. But isn't this too much for only posting one message? And if I want twitter too, do I have to use the twitter APK (if existing)?

  3. Should I abandon the idea of sending a screenshot, and use instead only a text message to promote the highscore (and my game with it) ?

Upvotes: 0

Views: 2613

Answers (1)

Raghav Sood
Raghav Sood

Reputation: 82563

You could use a Share intent to share your image. This will cause Android to show a dialog with all available apps that can share and image. The dialog will contain Facebook, twitter, google plus, SMS, whatsapp etc. if they are installed.

Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");// image/png if it's a png

share.putExtra(Intent.EXTRA_STREAM,
  Uri.parse("<path_to_image>"));

startActivity(Intent.createChooser(share, "Share Highscore"));

You will need to save your screenshot somewhere on the external or internal storage and provide the intent with a path to it before this can be done.

Upvotes: 1

Related Questions