Remove startForeground from AlarmService
Starting a foreground service from the background causes errors in android 12+
This commit is contained in:
parent
6e604d7618
commit
1e7c994209
|
@ -114,11 +114,10 @@ class AlarmService : Service(), OnPreparedListener {
|
||||||
return notification
|
return notification
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
@SuppressLint("Recycle")
|
@SuppressLint("Recycle")
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
|
||||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||||
val notification = doNotify()
|
doNotify()
|
||||||
startForeground(NOTIFICATION_ID_DONE, notification)
|
|
||||||
val settings = getSettings()
|
val settings = getSettings()
|
||||||
playSound(settings)
|
playSound(settings)
|
||||||
if (!settings.vibrate) return START_STICKY
|
if (!settings.vibrate) return START_STICKY
|
||||||
|
|
Loading…
Reference in New Issue