Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sending Email with attachment using Android emulator

 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an activity and it wishes to send a file(stored on SD card) as an email attachment.

So , I create an intent with Action = ACTION_SEND :



I populate the "To" and "Subject" fields using Intents "putExtra" methods:


I have the file that I need send as attachment in a FileInputStream, how do I attach it to email?
I think i can attach it using

Will this code work?

I tried running my code and when this logic was triggered an email editor was launched(No subject/ To fields were populated).
Is there a problem with emulator(specifically with its default email client?)

Thanks.



 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has any one tried sending an email on the emulator?
 
Mark L. Murphy
Author
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has any one tried sending an email on the emulator?


At minimum, you will need an email application on the emulator (e.g., K9). The tests I have done with sending email were all done on a device, though.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Mark..

Do you think i am treading the right path as regards sending email is concerned(can you please skim through the code in the first post)?
 
Mark L. Murphy
Author
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I haven't tried sending attachments. I think you're on the right track on the rest, though.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[I am reviving an old, unanswered thread...]

I need to send out emails and intercept them from my program(or atleast the program should be notified that an email is received).

I have tried sending emails from the emulator but without much luck(I have installed K-9 on my emulator) :|

Moreover, I am thinking of using EXTRA_STREAM to attach files too. Will this work on the real device?

What is the Android-action broadcast by the system when an email is recieved(assuming there is one)?

Thanks.
 
Ed Burnette
Author
Ranch Hand
Posts: 142
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic