tanguyantoine / react-native-music-control

Display and manage media controls on lock screen and notification center for iOS and Android.
https://www.npmjs.com/package/react-native-music-control
MIT License
697 stars 264 forks source link

Music control close notification does not work #356

Closed Joshmatjjen closed 3 years ago

Joshmatjjen commented 3 years ago

When Function is called to close the notification, it don't close, also when swiped

  1. MusicControl.stopControl(); MusicControl.enableControl('closeNotification', true, { when: 'always' });
  1. Platform ?

    • [ ] iOS
    • [x] Android
3. Device - [ ] Simulator - [x] Real device
Joshmatjjen commented 3 years ago

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