Skip to content

Latest commit

 

History

History
116 lines (88 loc) · 3.02 KB

INSTALL-ANDROID-AUTO.md

File metadata and controls

116 lines (88 loc) · 3.02 KB

Android Auto-linking Installation

react-native >= 0.60

With yarn

$ yarn add react-native-background-geolocation-firebase

With npm

$ npm install --save react-native-background-geolocation-firebase

Gradle Configuration

📂 android/build.gradle

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
+        // NOTE:  If you've installed react-native-firebase, you should already have this included.
+       classpath 'com.google.gms:google-services:4.3.3'    // Or higher.
    }
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
        appCompatVersion = "1.0.2"
        googlePlayServicesLocationVersion = "17.0.0"
+       firebaseCoreVersion = "17.4.4"                  // Or higher.
+       firebaseFirestoreVersion = "21.5.0"             // Or higher.

    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
+       maven {
+           // Required react-native-background-geolocation-firebase
+           url("${project(':react-native-background-geolocation-firebase').projectDir}/libs")
+       }

    }
}

📂 android/app/build.gradle

dependencies {
    .
    .
    .
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

+ // NOTE:  If you've installed react-native-firebase, you'll already have this added.
+ apply plugin: 'com.google.gms.google-services'

📂 google-services.json

⚠️ If you've installed react-native-firebase, you should already have performed this step.

Download your google-services.json from the Firebase Console. Copy the file to your android/app folder.

AndroidManifest.xml

📂 android/app/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.transistorsoft.backgroundgeolocation.react">

  <application
    android:name=".MainApplication"
    android:allowBackup="true"
    android:label="@string/app_name"
    android:icon="@mipmap/ic_launcher"
    android:theme="@style/AppTheme">

    <!-- react-native-background-geolocation licence -->
+   <meta-data android:name="com.transistorsoft.firebaseproxy.license" android:value="YOUR_LICENCE_KEY_HERE" />
    .
    .
    .
  </application>
</manifest>

ℹ️ Purchase a License