I created an app that is shown in email sending apps list .
In a special app when user clicked on an email address , all of email sending
apps apear on a list that my app is one of them and user can choose it.
I want to save email when user click on my app .
All things is fine but i dont know how i can get the emails from my app ?
I know other apps use this code :
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
"mailto","abc@gmail.com", null));
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Body");
startActivity(Intent.createChooser(emailIntent, "Send email..."));
But i dont know how access these data placed in Extra . i need to fetch mailto
value only from top code.
How i can get mailto
value now ?
Edit :
I have one app that shared many email addresses but i cant copy them . these emails are only links when i click them android apears all email sender apps . i wan to get this email one by one using my developed application and save them in a txt file .
EDIT 2 :
I find a way to show my app in all other apps email sender list.i find out different applications used different methods to put extra content for sending email .
for solve this problem and show your application in all of other applications email sending list i used many <intent-filter>
in my AndroidManifest.xml
like this :
Many apps used ACTION_VIEW
method to send email . if you want show your application in this type of apps , you must use this code in your manifest file :
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
Another type of apps used ACTION_SEND
to provide intent for calling email sender apps list . and if you want to show your app in these type of apps you must add this code to your AndroidManifest.xml
file and your Activity
tag :
You can see 3 method to provide intent , i found these ways to show my app inside all apps email sending list maybe another methods exist and i dont know right now:
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="mailto"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/*"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="message/*"/>
</intent-filter>
EDIT 3 : i used this code in my activity :
bundle = intent.getExtras();
if (bundle != null) {
for (String key : bundle.keySet()) {
Object value = bundle.get(key);
Log.d("Extra : ", String.format("%s %s (%s)", key,
value.toString(), value.getClass().getName()));
}
}
And now i get log :
D/Extra :: android.intent.extra.EMAIL [Ljava.lang.String;@2244b9ca ([Ljava.lang.String;)
it shows i have one value in extra and its name is android.intent.extra.EMAIL but i cant get this value . i tested many ways !