Skip to content

Commit 376daa2

Browse files
Fixed pr comments
1 parent 25fbf26 commit 376daa2

File tree

7 files changed

+13
-150
lines changed

7 files changed

+13
-150
lines changed

android/src/main/kotlin/com/icapps/background_location_tracker/service/LocationUpdatesService.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,16 @@ internal class LocationUpdatesService : Service() {
101101
// and binds with this service. The service should cease to be a foreground service
102102
// when that happens.
103103
Logger.debug(TAG, "OnBind")
104-
stopForeground()
104+
stopForegroundService()
105105
changingConfiguration = false
106106
return binder
107107
}
108108

109-
@Suppress("DEPRECATION")
110-
private fun stopForeground() {
109+
private fun stopForegroundService() {
111110
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
112111
stopForeground(STOP_FOREGROUND_REMOVE)
113112
} else {
113+
@Suppress("DEPRECATION")
114114
stopForeground(true)
115115
}
116116
}
@@ -120,7 +120,7 @@ internal class LocationUpdatesService : Service() {
120120
// and binds once again with this service. The service should cease to be a foreground
121121
// service when that happens.
122122
Logger.debug(TAG, "OnRebind")
123-
stopForeground()
123+
stopForegroundService()
124124
changingConfiguration = false
125125
super.onRebind(intent)
126126
}

android/src/main/kotlin/com/icapps/background_location_tracker/utils/NotificationUtil.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ internal object NotificationUtil {
5050
val intent = Intent(context, LocationUpdatesService::class.java)
5151
intent.putExtra(LocationUpdatesService.EXTRA_STARTED_FROM_NOTIFICATION, true)
5252
val cancelTrackingIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
53-
PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
53+
PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE)
5454
} else {
55+
@Suppress("UnspecifiedImmutableFlag")
5556
PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
5657
}
5758

5859
val clickPendingIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
5960
PendingIntent.getActivity(context, 0, context.packageManager.getLaunchIntentForPackage(context.packageName), PendingIntent.FLAG_IMMUTABLE)
6061
} else {
61-
PendingIntent.getActivity(context, 0, context.packageManager.getLaunchIntentForPackage(context.packageName),0)
62+
PendingIntent.getActivity(context, 0, context.packageManager.getLaunchIntentForPackage(context.packageName), 0)
6263
}
6364

6465
val title = if (SharedPrefsUtil.isNotificationLocationUpdatesEnabled(context)) {

example/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
buildscript {
2-
ext.kotlin_version = '1.6.0'
2+
ext.kotlin_version = '1.7.0'
33
repositories {
44
google()
55
mavenCentral()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.0.3'
9+
classpath 'com.android.tools.build:gradle:7.0.4'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ packages:
234234
source: hosted
235235
version: "4.2.4"
236236
shared_preferences:
237-
dependency: transitive
237+
dependency: "direct main"
238238
description:
239239
name: shared_preferences
240240
url: "https://pub.dartlang.org"

example/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies:
1212
sdk: flutter
1313
flutter_local_notifications: ^9.9.0
1414
permission_handler: ^10.0.0
15+
shared_preferences: ^2.0.15
1516

1617
dev_dependencies:
1718
flutter_test:

pubspec.lock

Lines changed: 2 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,6 @@ packages:
4343
url: "https://pub.dartlang.org"
4444
source: hosted
4545
version: "1.3.1"
46-
ffi:
47-
dependency: transitive
48-
description:
49-
name: ffi
50-
url: "https://pub.dartlang.org"
51-
source: hosted
52-
version: "2.0.1"
53-
file:
54-
dependency: transitive
55-
description:
56-
name: file
57-
url: "https://pub.dartlang.org"
58-
source: hosted
59-
version: "6.1.4"
6046
flutter:
6147
dependency: "direct main"
6248
description: flutter
@@ -67,18 +53,6 @@ packages:
6753
description: flutter
6854
source: sdk
6955
version: "0.0.0"
70-
flutter_web_plugins:
71-
dependency: transitive
72-
description: flutter
73-
source: sdk
74-
version: "0.0.0"
75-
js:
76-
dependency: transitive
77-
description:
78-
name: js
79-
url: "https://pub.dartlang.org"
80-
source: hosted
81-
version: "0.6.4"
8256
matcher:
8357
dependency: transitive
8458
description:
@@ -107,104 +81,6 @@ packages:
10781
url: "https://pub.dartlang.org"
10882
source: hosted
10983
version: "1.8.2"
110-
path_provider_linux:
111-
dependency: transitive
112-
description:
113-
name: path_provider_linux
114-
url: "https://pub.dartlang.org"
115-
source: hosted
116-
version: "2.1.7"
117-
path_provider_platform_interface:
118-
dependency: transitive
119-
description:
120-
name: path_provider_platform_interface
121-
url: "https://pub.dartlang.org"
122-
source: hosted
123-
version: "2.0.4"
124-
path_provider_windows:
125-
dependency: transitive
126-
description:
127-
name: path_provider_windows
128-
url: "https://pub.dartlang.org"
129-
source: hosted
130-
version: "2.1.3"
131-
platform:
132-
dependency: transitive
133-
description:
134-
name: platform
135-
url: "https://pub.dartlang.org"
136-
source: hosted
137-
version: "3.1.0"
138-
plugin_platform_interface:
139-
dependency: transitive
140-
description:
141-
name: plugin_platform_interface
142-
url: "https://pub.dartlang.org"
143-
source: hosted
144-
version: "2.1.2"
145-
process:
146-
dependency: transitive
147-
description:
148-
name: process
149-
url: "https://pub.dartlang.org"
150-
source: hosted
151-
version: "4.2.4"
152-
shared_preferences:
153-
dependency: "direct main"
154-
description:
155-
name: shared_preferences
156-
url: "https://pub.dartlang.org"
157-
source: hosted
158-
version: "2.0.15"
159-
shared_preferences_android:
160-
dependency: transitive
161-
description:
162-
name: shared_preferences_android
163-
url: "https://pub.dartlang.org"
164-
source: hosted
165-
version: "2.0.12"
166-
shared_preferences_ios:
167-
dependency: transitive
168-
description:
169-
name: shared_preferences_ios
170-
url: "https://pub.dartlang.org"
171-
source: hosted
172-
version: "2.1.1"
173-
shared_preferences_linux:
174-
dependency: transitive
175-
description:
176-
name: shared_preferences_linux
177-
url: "https://pub.dartlang.org"
178-
source: hosted
179-
version: "2.1.1"
180-
shared_preferences_macos:
181-
dependency: transitive
182-
description:
183-
name: shared_preferences_macos
184-
url: "https://pub.dartlang.org"
185-
source: hosted
186-
version: "2.0.4"
187-
shared_preferences_platform_interface:
188-
dependency: transitive
189-
description:
190-
name: shared_preferences_platform_interface
191-
url: "https://pub.dartlang.org"
192-
source: hosted
193-
version: "2.1.0"
194-
shared_preferences_web:
195-
dependency: transitive
196-
description:
197-
name: shared_preferences_web
198-
url: "https://pub.dartlang.org"
199-
source: hosted
200-
version: "2.0.4"
201-
shared_preferences_windows:
202-
dependency: transitive
203-
description:
204-
name: shared_preferences_windows
205-
url: "https://pub.dartlang.org"
206-
source: hosted
207-
version: "2.1.1"
20884
sky_engine:
20985
dependency: transitive
21086
description: flutter
@@ -259,20 +135,6 @@ packages:
259135
url: "https://pub.dartlang.org"
260136
source: hosted
261137
version: "2.1.2"
262-
win32:
263-
dependency: transitive
264-
description:
265-
name: win32
266-
url: "https://pub.dartlang.org"
267-
source: hosted
268-
version: "3.0.0"
269-
xdg_directories:
270-
dependency: transitive
271-
description:
272-
name: xdg_directories
273-
url: "https://pub.dartlang.org"
274-
source: hosted
275-
version: "0.2.0+2"
276138
sdks:
277-
dart: ">=2.17.0 <3.0.0"
278-
flutter: ">=3.0.0"
139+
dart: ">=2.17.0-0 <3.0.0"
140+
flutter: ">=2.0.0"

pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ environment:
1010
dependencies:
1111
flutter:
1212
sdk: flutter
13-
shared_preferences: ^2.0.15
1413

1514
dev_dependencies:
1615
flutter_test:

0 commit comments

Comments
 (0)