0

I need to send a mail alerts in background when the application is running. Now i tried with intent but the the mail client activity is initialized but i need to send mail i background without the user knowledge. How can i make it possible.

arnp
  • 3,178
  • 6
  • 26
  • 43

2 Answers2

0

As per Till Helge Helwig suggested put your sending mail code in service or in AsyncTask, Now without using Intent (Without user interaction) you can send mail.

For this look at Sending Emails without User Intervention (no Intents) in Android

also Sending Email in Android using JavaMail API without using the default android app(Builtin Email application)

or Sending email without user interaction in Android.

Thanks.

Community
  • 1
  • 1
user370305
  • 108,599
  • 23
  • 164
  • 151
0

you can get the default mail account via AccountManager class which contain the all the account which is associated with Account class

hear some code to define, how to get the default account value

 Account[] accounts = AccountManager.get(this).getAccounts();
 for (Account account : accounts) {
   String possibleEmail = account.name;}
Ashish Dwivedi
  • 8,048
  • 5
  • 58
  • 78