Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Share Entire Android App with Share Intent

I have used Sharing-type intents before, such as:

Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("plain/text"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "---" }); intent.putExtra(Intent.EXTRA_SUBJECT, "---"); startActivity(Intent.createChooser(intent, "Contact Us!")); 

However, this basically shares with Email/MMS and other text or document type apps. How do you do this same things but include Social sharing like Facebook, Twitter and Google Plus (to name the important ones). And WHAT I want to share is the app, where the text says, "hey download this link to check out the app!" (or something similar along those lines).

like image 336
TheLettuceMaster Avatar asked Dec 18 '12 20:12

TheLettuceMaster


People also ask

How do I send Intent from one app to another?

When you construct an intent, you must specify the action you want the intent to perform. Android uses the action ACTION_SEND to send data from one activity to another, even across process boundaries. You need to specify the data and its type.

What is content sharing in Android?

'Sharing' is really shorthand for sending content such as text, formatted text, files, or images between apps. So if 'sharing' == sending content, it makes slightly more sense that it is implemented using ACTION_SEND (or ACTION_SEND_MULTIPLE) Intents and its dozen extras.


1 Answers

To add the Facebook, Twitter etc. share options, the user just needs to have those applications installed. It's up to other applications what type of Intents they will tell the system they can handle.

Then a basic ACTION_SEND intent will get picked up.

Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT,     "Hey check out my app at: https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID); sendIntent.setType("text/plain"); startActivity(sendIntent); 

Source

like image 131
ataulm Avatar answered Sep 19 '22 16:09

ataulm