Re: [android-developers] How to specify an IntentFilter that only activates when the Intent comes from within my own app?
Please do not do this. It will not have the desired effect: it will
show up in the chooser for all apps. And, if the user tries tapping on
it from another app, that app crashes.
The only solution for the OP's original requirement is to roll a
custom chooser from scratch.
On Sun, Jan 13, 2013 at 1:12 AM, Joman Chu <jomanchu@gmail.com> wrote:
> Does android:exported=false do what you want? See
> http://developer.android.com/guide/topics/manifest/activity-element.html#exported
>
>
> On Sun, Jan 13, 2013 at 12:38 AM, William Ferguson
> <william.ferguson@xandar.com.au> 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+unsubscribe@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
> --
> 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+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Localized Android Question-and-Answer Sites: http://www.andglobe.com
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home