简体   繁体   中英

android media player notification

I have coded up a media player which streams MP3 from a website.

With a media player such as Winamp, I can go check my email or Facebook while its playing and then go back to win-amp by using the notification window. I wanted to know if I can do something like that with my media player.

I have looked at: Android Media Player Threading , Notifications and many more.

I goggled this concept and found a lot of confusing topics. Some people made a service while some make a foreground service and then added notification to that. I am confused on how I can make this possible. If someone can explain this concept (going from my activity class to notification bar) to me, I will be grateful. Sample code will be greatly appreciated too.

I found an answer to my question and decided to share with fellow novice users/students who are learning android development.

Basically, you have to use a service side by side with your activity class if you want an effective media player. After making the service, you have to make it into a foreground service which will help you make your media player into a notification.

If I am incorrect then please correct me. Thank you

Sample code: http://www.java2s.com/Code/Android/Media/UsingServicetoplaymediafile.htm

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