I am using the following code so that my app shows up when the user chooses a Share option in brower:
<intent-filter android:label="@string/share_to_myapp">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain"/>
</intent-filter>
I am unable to figure out how to retrieve the title and url from the intent when user choose my app to share .
Any help is appreciated.
You can use this:
Intent i = myActivity.getIntent();
String url = i.getClipData();
String title = i.getStringExtra(Intent.EXTRA_TITLE); //Title of content
String text = i.getStringExtra(Intent.EXTRA_TEXT); //Content
String subject = i.getStringExtra(Intent.EXTRA_SUBJECT); //Subject in case "mail"