Open Guichaguri opened 8 years ago
For iOS development, you should know that the new event handler is the same from cordova-plugin-battery-status, since the sendJavascript
function is now deprecated.
Since using OS icons is not recommended as they can be removed or renamed, I've included five icons from Material Icons, which are Apache 2.0 licensed, but I can change back to OS icons if you don't want to include assets.
And also, window.remoteControls.updateMetadata(null, successCallback, errorCallback);
disables the notification and the media buttons
The code is a little messy, but it works. Just let me know if it needs any API changes for iOS.
Sweet @Guichaguri! From my initial read through, it looks good. There will need to be an update to the Obj-C updateMetadata function to handle the object that's passed in rather than the array thats currently used. Hopefully I can put a little time towards it tomorrow. Thanks again for picking up the ball and running with it.
I just noticed the java files were outside the src folder. Fixed it, should work as expected now
Does this work with the app in the background for an extended period of time? What happens if the cordova activity is paused while the app is in the background? Most apps nowadays play media from a background service, and then use the service for notification interaction, thereby decoupling it from the activity.
@LukePulverenti I can't remember how I made it, I also don't use Cordova anymore. I've been using React Native as it has much better performance than Cordova, I've made the whole Android side for the react-native-music-control and now I'm working on a module combining audio, media controls and chromecast, the way it should have been since the start
Here it is the Android Support with the new API.
This implementation works with Android 4.X and greater. Most of the properties are not visible, but they are for integration with smart watches, cars, etc.
The lock screen wallpaper only changes in Android 5.X and greater.
API Functions supported by Android: