• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps can anyone help with programming

tweacle

Newbie
HI there

I have a music player that does cut out when phone calls received but not when other apps like a sat nav gives instructions.

Ive been told that ive got to have something called "duck" in it and was given this below.
I have a file manager on my phone. Could someone tell me where I am supposed to put the code I.E in the music player files or in the sat nav files.

Thanks

OnAudioFocusChangeListener afChangeListener = new OnAudioFocusChangeListener() {
public void onAudioFocusChange(int focusChange) {
if (focusChange == AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) {
// Lower the volume
} else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) {
// Raise it back to normal
}
}
};
 
The code seems to be a template (Lower the volume and Raise it back are just given as comments for you to complete) to show you how you could implement "duck" in a player.

Even if it was complete, you are not going to be able to just use a file manager and put that code somewhere. You would need the source code and to compile that with your changes added.
 
thanks

Sounds too complicated. I have music apps that cut out when phone rings but not when things like sat nav give directions
 
Did you communicate with the app developer about your request? Sometimes they can be really helpful.
 
Did you communicate with the app developer about your request? Sometimes they can be really helpful.

yup.gif
Send the code to the app developer. It needs to be written into the app, it's not something you can add to an app.
 
Moved your thread to a more appropriate forum where developers and other programmers can better assist you. :)

Let us know if you need any further help!
 
Back
Top Bottom