react-native-music-control icon indicating copy to clipboard operation
react-native-music-control copied to clipboard

Music control close notification does not work

Open akk7300 opened this issue 5 years ago • 14 comments

I added MusicControl.enableControl('closeNotification', true, {when: 'always'}) but it does not work.

Other buttons work fine correctly.

akk7300 avatar Jun 10 '20 05:06 akk7300

Hi @akk7300 If you can provide an example of how to simulate this issue I'm happy to look into it.

Thanks.

bradfloodx avatar Jun 10 '20 06:06 bradfloodx

`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

akk7300 avatar Jun 10 '20 08:06 akk7300

Ok thanks @akk7300 so this is just the default closeNotification event. I'll have a look into it.

bradfloodx avatar Jun 11 '20 11:06 bradfloodx

Closing notifications works on android 7, but it does not work on android 10 (did not test android 8 and 9)

HasanAlyazidi avatar Jul 03 '20 15:07 HasanAlyazidi

Notification does not close at all on android. (Tested on android 7+)

HasanAlyazidi avatar Aug 01 '20 12:08 HasanAlyazidi

Here is a GIF

  • Notice how the initial notification changes

  • The notification only closes when calling MusicControl.stopControl(); or killing the app.

Tested ^0.12.0

7-6877b83fa58b

HasanAlyazidi avatar Aug 17 '20 22:08 HasanAlyazidi

Same here, why hasn't this been resolved yet ?

Joshmatjjen avatar Oct 14 '20 13:10 Joshmatjjen

I just fixed it... first, run this script to install this version:
If using NPM npm i [email protected]

If using Yarn

yarn add [email protected]

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 avatar Oct 14 '20 13:10 Joshmatjjen

@Joshmatjjen still not fixed

HasanAlyazidi avatar Oct 16 '20 07:10 HasanAlyazidi

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

Screenshot_1602919987

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 avatar Oct 17 '20 07:10 HasanAlyazidi

@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

Joshmatjjen avatar Oct 22 '20 00:10 Joshmatjjen

Any progress on fixing this?

cstranex avatar Nov 23 '20 14:11 cstranex

I used stop button for close notification.

akk7300 avatar Dec 03 '20 18:12 akk7300

I am also facing this issue

krunalbad avatar Dec 15 '20 09:12 krunalbad