diff --git a/LocationUpdatesBackgroundKotlin/app/build.gradle b/LocationUpdatesBackgroundKotlin/app/build.gradle
index 77cf8b15..988a632b 100644
--- a/LocationUpdatesBackgroundKotlin/app/build.gradle
+++ b/LocationUpdatesBackgroundKotlin/app/build.gradle
@@ -17,18 +17,16 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-
apply plugin: 'kotlin-kapt'
android {
- compileSdkVersion 29
- buildToolsVersion "29.0.2"
+ compileSdkVersion 31
+ buildToolsVersion "31.0.0"
defaultConfig {
applicationId "com.google.android.gms.location.sample.locationupdatesbackgroundkotlin"
minSdkVersion 15
- targetSdkVersion 29
+ targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -44,28 +42,32 @@ android {
dataBinding {
enabled true
}
+
+ buildFeatures {
+ viewBinding true
+ }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation 'androidx.appcompat:appcompat:1.1.0'
- implementation 'androidx.core:core-ktx:1.2.0'
- implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'androidx.appcompat:appcompat:1.3.1'
+ implementation 'androidx.core:core-ktx:1.6.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
- implementation 'androidx.preference:preference:1.1.0'
+ implementation 'androidx.preference:preference:1.1.1'
- implementation 'androidx.room:room-runtime:2.2.4'
- kapt 'androidx.room:room-compiler:2.2.4'
+ implementation 'androidx.room:room-runtime:2.3.0'
+ kapt 'androidx.room:room-compiler:2.3.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
- implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
+ implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
kapt 'com.android.databinding:compiler:3.1.4'
- implementation 'com.google.android.gms:play-services-location:17.0.0'
+ implementation 'com.google.android.gms:play-services-location:18.0.0'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test.ext:junit:1.1.1'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
- implementation 'com.google.android.material:material:1.1.0'
+ testImplementation 'junit:junit:4.13.2'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.3'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
}
diff --git a/LocationUpdatesBackgroundKotlin/app/src/main/AndroidManifest.xml b/LocationUpdatesBackgroundKotlin/app/src/main/AndroidManifest.xml
index a89684e4..618bb4d3 100644
--- a/LocationUpdatesBackgroundKotlin/app/src/main/AndroidManifest.xml
+++ b/LocationUpdatesBackgroundKotlin/app/src/main/AndroidManifest.xml
@@ -19,6 +19,7 @@
package="com.google.android.gms.location.sample.locationupdatesbackgroundkotlin">
+
-
+
@@ -40,11 +42,7 @@
-
-
-
-
+ android:exported="false" />
\ No newline at end of file
diff --git a/LocationUpdatesBackgroundKotlin/app/src/main/java/com/google/android/gms/location/sample/locationupdatesbackgroundkotlin/data/MyLocationManager.kt b/LocationUpdatesBackgroundKotlin/app/src/main/java/com/google/android/gms/location/sample/locationupdatesbackgroundkotlin/data/MyLocationManager.kt
index 53675b90..793f2435 100644
--- a/LocationUpdatesBackgroundKotlin/app/src/main/java/com/google/android/gms/location/sample/locationupdatesbackgroundkotlin/data/MyLocationManager.kt
+++ b/LocationUpdatesBackgroundKotlin/app/src/main/java/com/google/android/gms/location/sample/locationupdatesbackgroundkotlin/data/MyLocationManager.kt
@@ -19,6 +19,7 @@ import android.Manifest
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
+import android.os.Build
import android.util.Log
import androidx.annotation.MainThread
import androidx.lifecycle.LiveData
@@ -81,7 +82,11 @@ class MyLocationManager private constructor(private val context: Context) {
private val locationUpdatePendingIntent: PendingIntent by lazy {
val intent = Intent(context, LocationUpdatesBroadcastReceiver::class.java)
intent.action = LocationUpdatesBroadcastReceiver.ACTION_PROCESS_UPDATES
- PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
+ } else {
+ PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
+ }
}
/**
diff --git a/LocationUpdatesBackgroundKotlin/build.gradle b/LocationUpdatesBackgroundKotlin/build.gradle
index 348a312a..62be5780 100644
--- a/LocationUpdatesBackgroundKotlin/build.gradle
+++ b/LocationUpdatesBackgroundKotlin/build.gradle
@@ -17,14 +17,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = '1.3.61'
+ ext.kotlin_version = '1.5.31'
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.6.1'
+ classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/LocationUpdatesBackgroundKotlin/gradle/wrapper/gradle-wrapper.properties b/LocationUpdatesBackgroundKotlin/gradle/wrapper/gradle-wrapper.properties
index b65e7745..1bf3826c 100644
--- a/LocationUpdatesBackgroundKotlin/gradle/wrapper/gradle-wrapper.properties
+++ b/LocationUpdatesBackgroundKotlin/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip