Hey all,

A while ago an issue came up on IRC regarding Media: if a phone received a 
phone call while a PhoneGap - er – Callback app was playing media, it wouldn't 
stop the media so you had music or whatever playing in the background during 
your phone call. Not ideal :)

I filed a bug for this on Android and Bryce slayed it, of course, but also came 
up with a pretty elegant solution to it. I would recommend the whole team check 
it out:

https://github.com/callback/callback-android/commit/0bbcf5cfd2349801d00e067424a66fa1086103ea

Plugins now can handle an onMessage event and can also broadcast a message to 
all other plugins. For example, on Android, a "telephony receiver" is 
registered on the app and when a phone call comes in or is hung up, a message 
is broadcast to all other plugins. The audio handler plugin will pause and 
resume all streams as phone calls come in / get hung up. Pretty nice!

A side effect for this latest commit is that the network plugin uses this 
approach to broadcast going online/offline to other plugins. Currently not used 
by other plugins but may be useful down the road.

The reason I'm posting this is because we want to keep our plugin interfaces 
aligned across platforms. It would be great if the other platforms implemented 
this as well. Also would love to hear what the rest of the team thinks of this 
change.

Reply via email to