Reputation: 2091
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:
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?
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)?
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
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