Automatically open and play attached MP3 file in email message?

Roveer

Member
Jan 13, 2015
19
0
0
Visit site
I'm writing a system that forwards my Fire/EMS scanner calls to my email so I can get these alerts when I'm not at home. I have the back-end system working and now I'd like to see if it's possible to automatically play the MP3 file when it is received (via email) on my android phone (Marshmallow). I'm assuming this can't be done natively? Does anyone know if there is an app that would do this?

Thanks,

Roveer
 

ManiacJoe

Trusted Member
Aug 5, 2015
6,326
3
38
Visit site
The ability to do that is most likely dependent on the email you are using.
Many email apps have options to control when attachments are downloaded, often based on wifi vs mobile data.
However, it is unlikely that you would get any app to actually launch/play any attachment automatically since that would normally be a huge security risk.

That said, if you take this conversation over to the "developer lounge" you will probably get some better technical answers.
 

Roveer

Member
Jan 13, 2015
19
0
0
Visit site
I'm wondering how difficult it would be to write an android app that would look into email on the phone for a certain sender and automatically play the attached MP3 file from the message? Is this something that would be possible? Where would I get started?
 

BayK

Active member
Apr 2, 2017
38
0
0
Visit site
It is pretty easy to make. Not a big deal at all.
You can create a service, (not an App, you need a service) that will check for new email at yours email address. here a link a link to add that sends an email. Receiving an email is using the same classes.

Form the Message you can get a title and attachments. Because it is your email, you know that attachment is an mp3 file. So you can play it in media player
Code:
String filePath = Environment.getExternalStorageDirectory()+"/yourfolderNAme/yopurfile.mp3";
mediaPlayer = new  MediaPlayer();
mediaPlayer.setDataSource(filePath);
mediaPlayer.prepare();   
mediaPlayer.start()

And you are done.
 
Last edited:

Forum statistics

Threads
943,007
Messages
6,916,856
Members
3,158,771
Latest member
planeboy