1

I have used code on this link to send email in background of my app: Sending Email in Android using JavaMail API without using the default/built-in app The problem is this worked fine when I debugged my application in android version 2.3.4 HTC Amaze 4G but when i installed the same application on android version 4.2.2 Samsung GT-I8852 the email is not sent. Can anyone think of a reason of why this happened as I don't know where to look for a fault?

Community
  • 1
  • 1
Maruf
  • 19
  • 4
  • Did you check device log? – AVEbrahimi Jun 10 '14 at 06:46
  • Are you sure mobile internet is activated properly? Are you able to manually configure the gmail and send an email? – ngrashia Jun 10 '14 at 06:52
  • Yes I have checked the internet connectivity before sending the email and I can manually send the email to any account using my gmail account from the app. – Maruf Jun 10 '14 at 06:59
  • Add logging throughout the actual implementation code so that you can see that it is making a genuine attempt, and what the step-by-step effect of that attempt is. In other words, if you aren't seeing anything in the log, modify the program until you are. – Chris Stratton Jun 11 '14 at 17:59

2 Answers2

0

If you doing things while your app is in background- android might kill your process any time, especially when it takes time or cpu. Try doing it with your app stays in the foreground. or do it with a Sticky Service

shem
  • 4,686
  • 2
  • 32
  • 43
  • The app is in the foreground but user isn't typing in the subject or the body of the email. I take info form user make the email body and give a subject to the email and the user just clicks send button on the app. – Maruf Jun 10 '14 at 09:11
0

This is not exactly the answer but I found this Mail wrapper and used it to send email and this works fine : http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_%28no_Intents%29_in_Android And do the actual sending in an AsyncTask.

Maruf
  • 19
  • 4