简体   繁体   中英

when to use service for MediaPlayerin android studio

In my app, I downloaded the audio from the server and then played, but the MediaPlayer was stopped by locking my cellphone, so I added a background service for playing. after that, I changed my mind and I wanted users can't access my audios, so I've encrypted audios and decrypted to play. By this way, I didn't need the background service. I am totally confused. I don't need the service because of saving on internal!!!!! Can you explain it? Thanks in advance

It depends on what type of application you are developing. If this is a music player where user should be able to listen even if app is closed, then use a service. Audios are merely files, if they are encrypted just decrypt them before playing. On the other hand if your application is some sort of an audio editor where user should actively use app while playing with audio, then you may not use a service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM