Android – sharing message via Facebook, e-mail, sms and others

Even if you have created the best app ever, you will not be successful unless you tell the world that it exists.

One of the options is to add a functionality that will let the users to share a link to your game via Facebook, e-mail, sms or any other service that they have installed on their phone:

Sharing on android

The code for Android for opening this window is as follows:

Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "TEXT_TO_SHARE");
startActivity(intent);

Sometimes you can encounter additional line of code:

intent.putExtra(Intent.EXTRA_SUBJECT, "SUBJECT_TO_SHARE");

however, unfortunately, it is not working with Facebook – the code has no effect.


←Table of contents
←My apps, games and other projects

Advertisements
Android – sharing message via Facebook, e-mail, sms and others

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s