Allow nullability of Intent parameter in converted services.

main
Alex Hart 2023-03-08 15:44:47 -04:00
rodzic fd3a509231
commit 7fd5b72204
1 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -456,11 +456,11 @@ class IncomingMessageObserver(private val context: Application) {
} }
class ForegroundService : Service() { class ForegroundService : Service() {
override fun onBind(intent: Intent): IBinder? { override fun onBind(intent: Intent?): IBinder? {
return null return null
} }
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
super.onStartCommand(intent, flags, startId) super.onStartCommand(intent, flags, startId)
val notification = NotificationCompat.Builder(applicationContext, NotificationChannels.getInstance().BACKGROUND) val notification = NotificationCompat.Builder(applicationContext, NotificationChannels.getInstance().BACKGROUND)
@ -481,9 +481,9 @@ class IncomingMessageObserver(private val context: Application) {
* A service that exists just to encourage the system to keep our process alive a little longer. * A service that exists just to encourage the system to keep our process alive a little longer.
*/ */
class BackgroundService : Service() { class BackgroundService : Service() {
override fun onBind(intent: Intent): IBinder? = null override fun onBind(intent: Intent?): IBinder? = null
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
Log.d(TAG, "Background service started.") Log.d(TAG, "Background service started.")
return START_STICKY return START_STICKY
} }