0

I am trying to use the native email compose in android apps on my table to send me logs when the apps crashes.

The code below works great but the Native Email compose pops up and you have to press send. Is there a way to tell the compose app just to send the email. Send it a click without having to manually do it?

Intent intent = new Intent(Intent.ACTION_SENDTO); // it's not ACTION_SEND
 intent.setType("message/rfc822");

 intent.setType("text/plain");
 intent.putExtra(Intent.EXTRA_SUBJECT, "Subject of email");
 intent.putExtra(Intent.EXTRA_TEXT,    "Body of email");
 intent.setData(Uri.parse("myeamil@yahoo.com")); // or just "mailto:" for blank
 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // this will make such that when user returns to your app, your app is displayed, instead of the email app.
 //startActivity(intent);

Thanks. Max

skaffman
  • 398,947
  • 96
  • 818
  • 769
Max Duret
  • 1
  • 1
  • 1

1 Answers1

0

You should try this question or this tutorial for more details

Community
  • 1
  • 1
ThaiPD
  • 3,503
  • 3
  • 30
  • 48
  • http://stackoverflow.com/questions/15055927/send-email-in-android-app/22834843#22834843 - I found this but and it looks like what I need but I can't figure out how I need to call it. The trouble with the other is you still have to press a send button I want this to happen automatically. – Max Duret Apr 01 '15 at 21:12
  • I don't understand why you have to press a send button with the answer above. All you need is create a thread and call email.send() – ThaiPD Apr 02 '15 at 04:05
  • I want to call if from several classes from my app. I want to send log files to me if the app crashes. I assume when you are saying email.send you are talking about the second set of code. The first I have to press the button. I was looking for a way to send a click or a command to gmail to tell it to send the email without having to manually press the button when it comes up – Max Duret Apr 02 '15 at 10:04