Skip to content

Latest commit

 

History

History
67 lines (54 loc) · 1.61 KB

INSTALL-MANUAL-ANDROID.md

File metadata and controls

67 lines (54 loc) · 1.61 KB

Android Manual Installation

$ npm install --save react-native-background-fetch

Gradle Configuration

📂 android/settings.gradle

+include ':react-native-background-fetch'
+project(':react-native-background-fetch').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-background-fetch/android')
  • 📂 android/build.gradle
allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        // Google now hosts their latest API dependencies on their own maven  server.  
        // React Native will eventually add this to their app template.
+        maven {
+            url 'https://maven.google.com'
+        }
    }
}

📂 android/app/build.gradle

+repositories {
+   flatDir {
+       dirs "../../node_modules/react-native-background-fetch/android/libs"
+   }
+}

dependencies {
+   compile project(':react-native-background-fetch')
+   compile(name: 'tsbackgroundfetch', ext: 'aar')
}

MainApplication.java

📂 android/app/main/java/com/.../MainApplication.java

+import com.transistorsoft.rnbackgroundfetch.RNBackgroundFetchPackage;
public class MainApplication extends ReactApplication {
  @Override
  protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
+     new RNBackgroundFetchPackage(),
      new MainReactPackage()
    );
  }
}