Is their any possibility to start a service throw a sound in android .If it is possible means please explain the steps with explanation
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think it is. For playing a “sound” you can use
MediaPlayerit is very easy to use with local files. You just put the sound files in your assets folder and then call play method of MediaPlayer with a reference to the file. Look apis for exact usage of MediaPlayer.For service portion, make a service and override
onStartServicemethod. in this method do all the stuff I said above about playing a sound.Note that if you use Service you should handle concurrency issues yourself like starting a new thread, ensuring only one sound playing at the same time etc.
So you can use an
IntentServicewhich basically starts a new thread for each incoming intent.