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

Does not work on Android 11 #369

Closed goleary closed 3 years ago

goleary commented 3 years ago

When I run the same application on Android 10 & 11 I see this:

Description

  1. Sample code (provide repo url or sample code)

https://github.com/goleary/react-native-music-control-min-repro

This is just a new react-native app with MusicControl added & enabled.

  1. Platform ?

    • [ ] iOS
    • [x] Android
3. Device - [x] Simulator - [x] Real device (I tested on both)
goleary commented 3 years ago

Turns out I was not calling MusicControl.setNowPlaying()

In Android 10 the Music notification shows up even without calling that method (if you just call MusicControl.enableControl('play', true).

On Android 11 if you don't call it then nothing shows up.

Here it is working: image

tanguyantoine commented 3 years ago

May I ask you to update the readme ? 🙏

goleary commented 3 years ago

Sure! I switched the order of the "Now Playing" & "Enable and Disable controls" sections in #370

Everything was in the readme, but the ordering of methods in the is what tripped me up