extending from the vector service to avoid extra service boilerplate

This commit is contained in:
Adam Brown 2021-11-04 09:47:16 +00:00
parent 48678382ba
commit 036a81d60b

View File

@ -15,13 +15,11 @@
*/
package im.vector.app.fdroid.service
import android.app.Service
import android.content.Intent
import android.os.IBinder
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.services.VectorService
import im.vector.app.features.notifications.NotificationUtils
import timber.log.Timber
import javax.inject.Inject
/**
@ -31,17 +29,10 @@ import javax.inject.Inject
* when the app is not in the foreground.
*/
@AndroidEntryPoint
class GuardService : Service() {
class GuardService : VectorService() {
@Inject lateinit var notificationUtils: NotificationUtils
override fun onBind(intent: Intent?): IBinder? = null
override fun onCreate() {
super.onCreate()
Timber.i("## Sync: onCreate GuardService")
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
val notificationSubtitleRes = R.string.notification_listening_for_notifications
val notification = notificationUtils.buildForegroundServiceNotification(notificationSubtitleRes, false)