Skip to content
This repository was archived by the owner on Oct 6, 2022. It is now read-only.

Music control close notification does not work #333

Open
akk7300 opened this issue Jun 10, 2020 · 14 comments
Open

Music control close notification does not work #333

akk7300 opened this issue Jun 10, 2020 · 14 comments

Comments

@akk7300
Copy link

akk7300 commented Jun 10, 2020

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

Other buttons work fine correctly.

@bradfloodx
Copy link
Collaborator

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

Thanks.

@akk7300
Copy link
Author

akk7300 commented Jun 10, 2020

`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

@bradfloodx
Copy link
Collaborator

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

@bradfloodx bradfloodx reopened this Jun 11, 2020
@HasanAlyazidi
Copy link

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

@HasanAlyazidi
Copy link

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

@HasanAlyazidi
Copy link

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

@Joshmatjjen
Copy link

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

@Joshmatjjen
Copy link

Joshmatjjen commented Oct 14, 2020

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

@HasanAlyazidi
Copy link

@Joshmatjjen still not fixed

@HasanAlyazidi
Copy link

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();

@Joshmatjjen
Copy link

@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

@cstranex
Copy link

Any progress on fixing this?

@akk7300
Copy link
Author

akk7300 commented Dec 3, 2020

I used stop button for close notification.

@krunalbad
Copy link
Contributor

I am also facing this issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants