Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
graszka22 committed Jun 14, 2024
1 parent d1a968c commit 07ffe5c
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,22 @@ class CameraService : Service() {
.setContentTitle("Fishjam is running")
.build()
ServiceCompat.startForeground(
/* service = */ this,
/* id = */ 100, // Cannot be 0
/* notification = */ notification,
/* service = */
this,
/* id = */
100, // Cannot be 0
/* notification = */
notification,
/* foregroundServiceType = */
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA
} else {
0
},
}
)
} catch (e: Exception) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
&& e is ForegroundServiceStartNotAllowedException
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
e is ForegroundServiceStartNotAllowedException
) {
// App not in a valid state to start foreground service
// (e.g. started from bg)
Expand All @@ -72,4 +75,4 @@ class CameraService : Service() {
override fun onBind(intent: Intent): IBinder? {
return null
}
}
}

0 comments on commit 07ffe5c

Please sign in to comment.