- Add the following required
maven
repo url:
allprojects { // <-- IMPORTANT: allprojects
repositories {
google()
mavenCentral()
// [required] flutter_background_geolocation
maven { url "${project(':flutter_background_geolocation').projectDir}/libs" }
// [required] background_fetch
maven { url "${project(':background_fetch').projectDir}/libs" }
+ // [required] background_geolocation_firebase
+ maven { url "${project(':background_geolocation_firebase').projectDir}/libs" }
}
}
-
If you're using
flutter >= 3.19.0
(New Android Architecture):
+ext {
+ compileSdkVersion = 34 // or higher / as desired
+ targetSdkVersion = 34 // or higher / as desired
+ minSdkVersion = 21 // Required minimum
+ FirebaseSDKVersion = "33.4.0" // or as desired.
+}
buildscript {
ext.kotlin_version = '1.3.0' // Must use 1.3.0 OR HIGHER
+ ext {
+ compileSdkVersion = 34 // or higher / as desired
+ targetSdkVersion = 34 // or higher / as desired
+ minSdkVersion = 21 // Required minimum
+ FirebaseSDKVersion = "33.4.0" // or as desired.
+ }
}
Note
the param ext.FirebaseSdkVersion
controls the imported version of the Firebase SDK (com.google.firebase:firebase-bom
). Consult the Firebase Release Notes to determine the latest version of the Firebase SDK
- Add the
google-services
plugin (if you haven't already):
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.1" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
+ id 'com.google.gms.google-services' version '4.3.15' apply false // Or any desired version.
}
- In your app level
build.gradle
, apply thegoogle-services
plugin:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
+ id "com.google.gms.google-services"
}
Download your google-services.json
from the Firebase Console. Copy the file to your android/app
folder.
If you've purchased a license, add your license key to the AndroidManifest.xml
. If you haven't purchased a key, the SDK is fully functional in debug builds so you can try before you buy.
📂 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">
<!-- Flutter Background Geolocation License -->
<meta-data android:name="com.transistorsoft.locationmanager.license" android:value="YOUR_BACKGROUND_GEOLOCATION_LICENSE" />
+ <!-- Flutter Background Geolocation Firebase licence -->
+ <meta-data android:name="com.transistorsoft.firebaseproxy.license" android:value="YOUR_LICENCE_KEY_HERE" />
.
.
.
</application>
</manifest>