Reputation: 38872
I know I can use android build in email app when I use the intent with ACTION_SEND, there is no problem for me. The problem comes after I defined the ACTION_SEND in my AndroidManifest.xml like follows:
<activity android:name=".activity.myActivity">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/png" />
</intent-filter>
</activity>
Since I would like to see my own app to be added in the share option list when user click "share" in the gallery, I have to define the above <intent-filter>
in my AndroidManifest.xml.
After I defined the above configuration in AndroidManifest.xml, whenever I call "Intent emailIntent = new Intent(Intent.ACTION_SEND);
", my android app will go to call "myActivity" instead of calling android build in email app.
All of the above is understandable, my question is how to keep my configuration in AndroidManifest.xml as above (that's keep my app shown in the share option list when user click "share" in gallery), MEANWHILE, I can call the android default email app???
Upvotes: 0
Views: 809
Reputation: 1007296
After I defined the above configuration in AndroidManifest.xml, whenever I call "Intent emailIntent = new Intent(Intent.ACTION_SEND);", my android app will go to call "myActivity" instead of calling android build in email app.
That will only occur if the user set your application to be the default for this particular action and MIME type combination.
MEANWHILE, I can call the android default email app???
You are not calling "the default email app". Starting an activity with ACTION_SEND
says you want the user and OS to choose an activity to handle the request. If the user set up one activity as the default for this, that activity will start up, because that is what the user asked for.
You can use createChooser()
(static method on Intent
) to force a selection from all available candidates, and this is sometimes used with ACTION_SEND
.
Upvotes: 1