Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit c62b84c

Browse files
Fix PendingIntent mutability for Location Updates on Android 12
1 parent 62db354 commit c62b84c

File tree

1 file changed

+6
-1
lines changed
  • LocationUpdatesBackgroundKotlin/app/src/main/java/com/google/android/gms/location/sample/locationupdatesbackgroundkotlin/data

1 file changed

+6
-1
lines changed

LocationUpdatesBackgroundKotlin/app/src/main/java/com/google/android/gms/location/sample/locationupdatesbackgroundkotlin/data/MyLocationManager.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ class MyLocationManager private constructor(private val context: Context) {
8383
val intent = Intent(context, LocationUpdatesBroadcastReceiver::class.java)
8484
intent.action = LocationUpdatesBroadcastReceiver.ACTION_PROCESS_UPDATES
8585
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
86-
PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
86+
PendingIntent.getBroadcast(
87+
context,
88+
0,
89+
intent,
90+
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
91+
)
8792
} else {
8893
PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
8994
}

0 commit comments

Comments
 (0)