Another way would be to use a custom Mime type for your data, instead of 
text/plain, and only your IntentFilter services that type. I like the 
exported="false" solution better though.


On Saturday, January 12, 2013 9:38:25 PM UTC-8, William Ferguson wrote:
>
> I have an Activity that responds to the ACTION_SEND Intent. Is there any 
> way for me to be able to specify the IntentFilter such that the Activity is 
> only displayed by the IntentChooser when it has been called from within my 
> app?
>
> Ie I want the SendIntentResponderActivity displayed as a viable recipient 
> of ACTION_SEND, but only if I am the one that issued the Intent. NB 
> displaying my Activity shouldn't stop other standard responders (such as 
> Gmail etc) from also being displayed.
>
> <activity android:name=".SendIntentResponderActivity">
>>     <intent-filter>
>>         <action android:name="android.intent.action.SEND"/>
>>         <category android:name="android.intent.category.DEFAULT"/>
>>         <data android:mimeType="text/plain"/>
>>     </intent-filter>
>> </activity>
>
>
>  
>
>> final Intent shareIntent = new Intent(Intent.ACTION_SEND);
>> shareIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
>> shareIntent.putExtra(Intent.EXTRA_TEXT, content);
>> final Intent chooserIntent = Intent.createChooser(shareIntent, "Share 
>> via"));
>> context.startActivity(chooserIntent);
>
>
> William

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to