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

Latest commit

 

History

History
81 lines (57 loc) · 1.65 KB

README-PRE-0.60.md

File metadata and controls

81 lines (57 loc) · 1.65 KB

react-native-music control

Installation For React Native < v0.60

Linking on iOS

Automatic

react-native link

Manual

In XCode, right click Libraries. Click Add Files to "[Your project]". Navigate to node_modules/react-native-music-control. Add the file MusicControl.xcodeproj.

In the Project Navigator, select your project. Click the build target. Click Build Phases. Expand Link Binary With Libraries. Click the plus button and add libMusicControl.a under Workspace.

CocoaPods

pod 'react-native-music-control', :path => '../node_modules/react-native-music-control'

Run pod install in /ios folder.


Linking on Android

Automatic

react-native link

Manual

android/app/build.gradle

dependencies {
    ...
    compile "com.facebook.react:react-native:+"  // From node_modules
+   compile project(':react-native-music-control')
}

android/settings.gradle

...
include ':app'
+include ':react-native-music-control'
+project(':react-native-music-control').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-music-control/android')

MainApplication.java

+import com.tanguyantoine.react.MusicControl;

public class MainApplication extends Application implements ReactApplication {
    //......

    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
+           new MusicControl(),
            new MainReactPackage()
        );
    }

    //......
  }

Add following to your project AndroidManifest.xml

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />