Oppo Releases ColorOS for the Find 5… Poorly

Almost every OEM has taken the liberty of creating its own incarnation of the Android OS. … more

XDA LG Development Challenge Winners

Almost 3months ago, we set out with LGto findtwo amazing apps that developers could put together … more

Wearable Apps w/ Andreas Göransson – XDA:DevCon 2014

XDA:DevCon 2014 in Manchester, UK featured quite a few interesting topics as … more

Browse Your Files with Ease using MK Explorer

Google has made quite an effort in perfecting the powerful and multi-faceted OS that we know as … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[LIBRARY] Background Mail Library

OP krvoZD

10th December 2013, 02:09 PM   |  #1  
krvoZD's Avatar
OP Junior Member
Flag Zadar
Thanks Meter: 10
 
11 posts
Join Date:Joined: Aug 2012
Donate to Me
More
This is my first library, and also the first git upload.

Library is used for background sending mail from Gmail account.



Usage if very simple:

Code:
BackgroundMail bm = new BackgroundMail(context);
bm.setGmailUserName("yourgmail@gmail.com");
bm.setGmailPassword("yourgmailpassword");
bm.setMailTo("receiver@gmail.com");
bm.setFormSubject("Subject");
bm.setFormBody("Body");
bm.send();
...and you will need permissions

Code:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
This is optional

Code:
bm.setSendingMessage("Loading...");
bm.setSendingMessageSuccess("Your message was sent successfully.");
bm.setProcessVisibility(false);
bm.setAttachment(Environment.getExternalStorageDirectory().getPath()+File.pathSeparator+"somefile.txt");
Last release

BackgroundMailLibrary 1.5

Change log:
Quote:

Version 1.5
*fix #4

Version 1.4
*Added attachments support

Version 1.3
*Added password encryption for better security

Version 1.2
*Added process visibility feature

Version 1.1
*Added demo
*Bug fix

Version 1.0
*First upload

Here is link on Github

https://github.com/kristijandraca/BackgroundMailLibrary

Follow me

https://plus.google.com/u/0/+KristijanDrača
Last edited by krvoZD; 16th December 2014 at 02:50 PM. Reason: new version
The Following 10 Users Say Thank You to krvoZD For This Useful Post: [ View ]
10th December 2013, 05:36 PM   |  #2  
DaGr81's Avatar
Member
Flag Kathmandu
Thanks Meter: 21
 
71 posts
Join Date:Joined: Aug 2010
More
Question
what about sending email using gmail's intent but without showing gmail's interface?
11th December 2013, 03:45 PM   |  #3  
krvoZD's Avatar
OP Junior Member
Flag Zadar
Thanks Meter: 10
 
11 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Quote:
Originally Posted by DaGr81

what about sending email using gmail's intent but without showing gmail's interface?

not bad. I prefer this way.
1st January 2014, 06:16 PM   |  #4  
~Black's Avatar
Junior Member
Thanks Meter: 2
 
14 posts
Join Date:Joined: Oct 2011
good job pal
1st January 2014, 07:07 PM   |  #5  
taomorpheus's Avatar
Recognized Developer
Thanks Meter: 2,375
 
1,043 posts
Join Date:Joined: Nov 2011
Hi, nice idea, but if the user has to input the password, I find the intent safer and much more trusted.
The Following User Says Thank You to taomorpheus For This Useful Post: [ View ]
1st January 2014, 07:30 PM   |  #6  
David 617's Avatar
Senior Member
Thanks Meter: 246
 
590 posts
Join Date:Joined: May 2011
Quote:
Originally Posted by DaGr81

what about sending email using gmail's intent but without showing gmail's interface?

Is this even possible?

Sent from my Galaxy Nexus using Tapatalk
1st January 2014, 08:28 PM   |  #7  
tom4444's Avatar
Member
Thanks Meter: 28
 
42 posts
Join Date:Joined: Sep 2013
More
Good!
Thank you, exactly what I've wanted!
2nd January 2014, 05:34 AM   |  #8  
njarun's Avatar
Senior Member
Kottayam
Thanks Meter: 45
 
158 posts
Join Date:Joined: Sep 2011
More
So you need to enter the username and password for it right?

This is already done and show some references or credits, people deserve it. Link i found in the stackoverflow some months before - LINK

Also using this library or this method the chances of play store app suspension is very HIGH. and Im one of the developer who faced it. My app was sending mails from background with users request. It collected username and password (but never manipulated). And ended up in app suspension!!

Now i use GMAIL AUTH for sending mails from background. And this is the preferred method since it never collect the users ID and Password. The user will be prompted to login the gmail in a web interface and if he authorize your app, the app can send mails from background without user intervention then... as simple as that, and a safe and secure way!
3rd January 2014, 10:42 AM   |  #9  
krvoZD's Avatar
OP Junior Member
Flag Zadar
Thanks Meter: 10
 
11 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Thank you all for your interest in this project. I'm not saying it's perfect safety, feel free to add your code. I have added password encryption in the new version.
6th January 2014, 03:30 AM   |  #10  
Junior Member
Thanks Meter: 2
 
18 posts
Join Date:Joined: Nov 2013
thanx for sharing your library. but i still prefer to use intents. i guess to each his own.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes