GSoC/GCI Archive
Google Code-in 2014 KDE

KDEConnect-Android: Implement AudioFocus to make RemoteMediaControl work.

completed by: Da-Jin Chu

mentors: Albert Vaca

KDE Connect allows you to remotely control a media player running on your PC, like Amarok, from an Android phone. In a previous task we implemented a RemoteControlClient for it, so we can also control the music through external Android apps and from lock screen in Android 4.4.

Code for the previous task:

However, we discovered that RemoteControlClient was not enough, among other reasons, because we also need to get and release an "Audio Focus" to tell Android that we are playing music. This task aims to complete the previous one, properly managing the Audio Focus and adding whatever we need to make it work in every scenario. 

Note that managing the Audio Focus can be tricky in KDE Connect because we are not actually playing music on the phone, but on the computer. This means, for example, that we don't need to stop playing music when we lose the Audio Focus. This kind of decisions will be need to be addressed during the development of this task, try to make your own choices thinking in how our users would expect it to work.

I have a Pebble watch which includes music controls, and I would be supper happy if I could control the music in my computer through it :)