Find Jobs
Hire Freelancers

Move MediaPlayer to a Service. Troubleshoot issues surrounding loops when phone sleeping.

£10-20 GBP

Suoritettu
Julkaistu noin 10 vuotta sitten

£10-20 GBP

Maksettu toimituksen yhteydessä
I already have a fully functioning application that plays sounds when the user presses buttons on the MainActivity. There are around 15 sounds that loop continuously and 15 buttons. I need to move the MediaPlayer from MainActivity into a Service and to only have ONE general MediaPlayer Service for every single sound that needs to be played. Currently the buttons on click associate a resId that the MediaPlayer uses to play the correct sound. An example of this is: public void onClick(View v) { int resId; switch ([login to view URL]()) { case R.id.button_1: resId = [login to view URL]; break; case R.id.button_2: resId = R.raw.brown_noise; break; default: resId = [login to view URL]; break; } // Release any resources from previous MediaPlayer if (mp != null) { [login to view URL](); } // Create a new MediaPlayer to play this sound mp = [login to view URL](this, resId); [login to view URL](true); [login to view URL](); The MediaPlayer service needs to be able to listen for the resId and to play the correct sound accordingly. ONE MediaPlayer Service needs to be able to play ALL sounds and to play the correct sound depending on button press. As well as this, the developer needs to rewrite sections of code such as: PhoneStateListener phoneStateListener = new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) { if ([login to view URL]() && state == TelephonyManager.CALL_STATE_RINGING) { [login to view URL](0,0); } else if([login to view URL]() && state == TelephonyManager.CALL_STATE_IDLE) { [login to view URL](1,1); } else if([login to view URL]() && state == TelephonyManager.CALL_STATE_OFFHOOK) { [login to view URL](0,0); } [login to view URL](state, incomingNumber); } }; TelephonyManager mgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); if(mgr != null) { [login to view URL](phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); } To work with the MediaPlayer Service as MainActivity will no longer be able to determine isPlaying() and will not be able to set the MediaPlayer volume as the MediaPlayer is outside of it, and is instead inside the Service. This section will need writting also: [login to view URL](new [login to view URL]() { public void onClick(View v) { if(null!=mp){ [login to view URL](); [login to view URL](R.drawable.ic_action_volume_muted); } To ensure that the STOP button on the MainActivity will be able to tell the MediaPlayer Service to release() the MediaPlayer. Additionally the developer will need to troubleshoot issues surrounding the MediaPlayer loops having a 0.5 second gap between them when the phone goes to sleep (Is locked or the screen dims). The sounds should loop continuously and seamlessly until the STOP button is called.
Projektin tunnus (ID): 5503667

Tietoa projektista

6 ehdotukset
Etäprojekti
Aktiivinen 10 vuotta sitten

Haluatko ansaita rahaa?

Freelancerin tarjouskilpailun edut

Aseta budjettisi ja aikataulu
Saa maksu työstäsi
Kuvaile ehdotustasi
Rekisteröinti ja töihin tarjoaminen on ilmaista
Myönnetty käyttäjälle:
Käyttäjän avatar
Hi. I have lots of experience in android development and I have worked with playing sounds in android on button click. let me try it
£23 GBP 2 päivässä
5,0 (154 arvostelua)
6,6
6,6
6 freelancerit tarjoavat keskimäärin £42 GBP tätä projektia
Käyttäjän avatar
Hi sir i want to work on your project. Please message me your project's Download link so we can start working on it. Waiting for your response. :)
£30 GBP 3 päivässä
5,0 (26 arvostelua)
4,1
4,1
Käyttäjän avatar
Hi Dear I'm an Android Expert. I can help you. Please let's discuss in more detail. Best Regards
£33 GBP 1 päivässä
5,0 (3 arvostelua)
2,9
2,9
Käyttäjän avatar
Đề xuất vẫn chưa được gửi
£20 GBP 3 päivässä
5,0 (1 arvostelu)
0,0
0,0
Käyttäjän avatar
Hey This one if fairly simple. I have done the same thing in the past. If you send me a document with all the requirements and accept my off then I'll get started right away. I'm looking forward to workig on this project. Kinds regards Christophe
£133 GBP 3 päivässä
0,0 (0 arvostelua)
0,0
0,0

Tietoja asiakkaasta

Maan UNITED KINGDOM lippu
Towcester, United Kingdom
5,0
1
Maksutapa vahvistettu
Liittynyt maalisk. 1, 2014

Asiakkaan vahvistus

Kiitos! Olemme lähettäneet sinulle sähköpostitse linkin, jolla voit lunastaa ilmaisen krediittisi.
Jotain meni pieleen lähetettäessä sähköpostiasi. Yritä uudelleen.
Rekisteröitynyttä käyttäjää Ilmoitettua työtä yhteensä
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Ladataan esikatselua
Lupa myönnetty Geolocation.
Kirjautumisistuntosi on vanhentunut ja sinut on kirjattu ulos. Kirjaudu uudelleen sisään.