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

Expo config plugin #406

Open code4break opened 2 years ago

code4break commented 2 years ago

It would be cool, if this lib supports managed Expo projects. So that it will be easy to integrate.

Description

  1. Sample code (provide repo url or sample code) https://docs.expo.dev/guides/config-plugins/#creating-a-plugin
  1. Platform

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

Hi @FireFighter80, I think you can use without the need of a plugin.

In the app.json

{
  "expo": {
    "name": "my-app",
    "ios": {
      "infoPlist": {
        "UIBackgroundModes": ["audio"]
      },
    },
    "android": {
      "permissions": ["FOREGROUND_SERVICE"]
    },
  }
}

https://docs.expo.dev/guides/config-plugins/#using-a-plugin-in-your-app

Plugins are mostly meant to be used with expo prebuild or eas build commands.

I tested on android with prebuild and eas build.