• 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
Jul 29, 2010
23
1
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.
 
Upvote 0
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.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones