Email Advanced - XML ​​Preferences

I want to call email from the xml settings screen, and also add a predefined object and start the cursor in the Body field of the email application.

That's what i still have

<Preference android:title="Support" android:summary="Having a problem?"> <intent android:action="android.intent.action.VIEW" android:data="mailto:support@xxxxx.com" /> </Preference> 

Works great for triggering email intent, but how do I go about executing others through xml? to attach a subject and all?

+9
android xml android-intent email preferences
Aug 04 2018-11-21T00:
source share
2 answers

You can use mailto request parameters as jondavidjohn says, as well as additional intentions, and you can mix and match them both. For example:

 <intent android:action="android.intent.action.VIEW" android:data="mailto:xxxxx@xxxxxxx.com?subject=this is a test subject"> <extra android:name="android.intent.extra.TEXT" android:value="This is a test" /> </intent> 

... will allow you to establish the body of the letter as well as the subject. You can also specify a topic as an additional. It also allows the use of XML string resources, rather than hardcoding:

  <extra android:name="android.intent.extra.SUBJECT" android:value="@string/email_subject" /> 

I just grabbed the optional Intent names from Intent.java; all email related are all in a bunch.

I just discovered this and haven't done much testing, but it seems to work with my GMail email client.

Also, if that helps, I have had success using the mailto: URI body, for example.

  mailto:example@example.com?subject=This%20is%20a%20subject&body=This%20is%20a%20body 

Don't know if this helped me with the URL of my email url; I just did it out of habit based on the web background. But it definitely works and installs the body in GMail and K9 Mail applications.

+20
Mar 12 2018-12-12T00:
source share

Apparently, you can use many query arguments that you can use in the regular mailto: uri browser.

So, for this you just need to use them like this.

 <intent android:action="android.intent.action.VIEW" android:data="mailto:xxxxx@xxxxxxx.com?subject=this is a test subject" /> 
+2
Aug 05 2018-11-11T00:
source share



All Articles