How to send email with attachment in background---Android Mode.

edited May 12 in Android Mode

Hello

Question 1 is: how to send email with attachment in background, aka, without user interference. e.g there is a button on the app, user taps the button, app send stuff immediately, without open build in email app.

I have tried https://forum.processing.org/two/discussion/17064/how-to-send-an-email-via-processing, it worked, but this is in Java mode, what I want is something like this but in Android mode. A search leads me to this, http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a The question is ,how to "convert" the above code in Processing. As I know nothing about coding for Android. What I thought about P5 Android Mode was, I worte some code in Java mode, tested ok, then, switch to Android mode, everything should work just fine. Unfortunatelly, this is not the case. It appears, if I want to do app for Android, I have to learn stuff specifically for Android.

Question 2: Is there any profesional who can give me some advice as for if I want to do app for Android in Processing (I only know processing, and I love it's simplicty, easy to use)which book or online resources I should check? Please be noted, as for coding, till now, I am only a beginner of Processing.

Thank you for your help and reply.

Tagged:

Answers

  • edited May 12 Answer ✓

    @bizkit_j===

    -- processing (android mode) is mainly some kind of cool graphics library, which can be extended using external libs (as ketai) - if they are updated & working... That is for answering your 2' question: if you really want to code for android learn android and use as or eclipse...

    -- sending email (with or without attachment) is an example; you cannot do that using only processing; you have to add android code :

    you create a method with or without params (some string, the path to your attachment....) then you create an Intent with ACTION_SEND, then youd add extras to your intent with putExtra; last extra is for the attachment::

    monEmaiIntent.putExtra(Intent.EXTRA_STREAM, your path to attachment);

    after that:: startActivity(monEmailIntent)....

  • Answer ✓

    @Bizkit_j

    The java mail version will not work in android. If we think about Processing code, you should be able to switch back and forth from Java to android mode and your code should work. Using external libraries, not so much. in Android mode, you can use the Ketai library which was designed to work with Processing Android mode. You can check the source code of Ketai(ketai.org) to have a quick glimpse of how they integrated the android API into Processing. Ketai offers a really good variety of resources that allow you to use your device's features while using Processing. But the resources of this lib is limited. If you want to exploit the full power of Android, you should consider learning Android directly. For starters, you could go to the local library and explore resources available there. That is a good way to start looking at books available and if you like they lay out of the material. Reading is not fun and you should do the practical part as well... the coding. I can also suggest doing an online course. TutorialsPoint or a nanodegree by udacity are few of the many options out there.

    You should consider using eclipse or AS. You could technically use Processing as well.

    You can explore previous posts (I believe you have done so) and you can see what people have done so far.

    Kf

Sign In or Register to comment.