File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
java/com/whyranoid/presentation/running Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 21
21
<meta-data android : name =" com.whyranoid.presentation.running.WorkManagerInitializer"
22
22
android : value =" androidx.startup" />
23
23
</provider >
24
+ <service
25
+ android : name =" androidx.work.impl.foreground.SystemForegroundService"
26
+ android : foregroundServiceType =" location"
27
+ tools : node =" merge" />
24
28
</application >
25
29
26
30
</manifest >
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import android.content.Intent
9
9
import android.location.Location
10
10
import android.location.LocationListener
11
11
import android.location.LocationManager
12
+ import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION
12
13
import android.os.Build
13
14
import android.os.Looper
14
15
import androidx.annotation.RequiresApi
@@ -74,6 +75,9 @@ class RunningWorker @AssistedInject constructor(
74
75
.setOngoing(true )
75
76
.build()
76
77
78
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q ) {
79
+ return ForegroundInfo (NOTIFICATION_ID , notification, FOREGROUND_SERVICE_TYPE_LOCATION )
80
+ }
77
81
return ForegroundInfo (NOTIFICATION_ID , notification)
78
82
}
79
83
You can’t perform that action at this time.
0 commit comments