Music control close notification does not work
Opened this issue · 14 comments
I added MusicControl.enableControl('closeNotification', true, {when: 'always'}) but it does not work.
Other buttons work fine correctly.
Hi @akk7300 If you can provide an example of how to simulate this issue I'm happy to look into it.
Thanks.
`constructor(props) {
super(props);
this.state = { }
MusicControl.enableControl('play', true);
MusicControl.enableControl('pause', true);
MusicControl.enableControl('nextTrack', true)
MusicControl.enableControl('previousTrack', true)
MusicControl.enableControl('closeNotification', true, {when: 'always'})
}
componentDidMount(){
MusicControl.on('play', ()=> {
this.playControl();
})
MusicControl.on('pause', ()=> {
this.PauseControl();
})
MusicControl.on('nextTrack', ()=> {
this.NextControl();
})
MusicControl.on('previousTrack', ()=> {
this.previousControl();
})
MusicControl.on('closeNotification',()=>{
this.closeNotiControl();
})
}`
Play Pause Next and Previous Button show in notification and can control
But close notification on swipe not working
Ok thanks @akk7300 so this is just the default closeNotification
event. I'll have a look into it.
Closing notifications works on android 7, but it does not work on android 10 (did not test android 8 and 9)
Notification does not close at all on android. (Tested on android 7+)
Same here, why hasn't this been resolved yet ?
I just fixed it... first, run this script to install this version:
If using NPM
npm i react-native-music-control@0.10.8
If using Yarn
yarn add react-native-music-control@0.10.8
This is an example of the code i used
if (state.pause === true) {
MusicControl.updatePlayback({ state: MusicControl.STATE_PAUSED, });
// Make your choice with any of this functions
MusicControl.enableControl('closeNotification', true, { when: 'paused' });
MusicControl.enableControl('closeNotification', true, { when: 'always' });
MusicControl.stopControl();
}
Hope this could help anyone out there
@Joshmatjjen still not fixed
Hi @Joshmatjjen
Closing the notification on swipe works on v0.10.8
and v0.11.0
, BUT the notification is blank on android 5.0
v0.12.0
= blank notification and does not close on swipe or calling MusicControl.resetNowPlaying();
and MusicControl.stopControl();
v1.2.1
= notification looks right but does not close on swipe or calling MusicControl.resetNowPlaying();
and MusicControl.stopControl();
@HasanAlyazidi Have you tired changing the min-sdk version to 16 or 17 in your build.gradle...
If it dont work, You have to create your app to only andriod greater than 5.0
Any progress on fixing this?
I used stop button for close notification.
I am also facing this issue