2018-01-04 19:52:25 +01:00
|
|
|
package jp.juggler.subwaytooter
|
|
|
|
|
|
|
|
import android.content.BroadcastReceiver
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.Intent
|
2020-12-11 18:30:10 +01:00
|
|
|
import jp.juggler.subwaytooter.notification.PollingWorker
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-12-01 00:02:18 +01:00
|
|
|
import jp.juggler.util.LogCategory
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
class EventReceiver : BroadcastReceiver() {
|
2021-06-20 15:12:25 +02:00
|
|
|
|
|
|
|
companion object {
|
|
|
|
internal val log = LogCategory("EventReceiver")
|
|
|
|
const val ACTION_NOTIFICATION_DELETE = "notification_delete"
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onReceive(context: Context, intent: Intent?) {
|
|
|
|
when (val action = intent?.action) {
|
|
|
|
|
|
|
|
Intent.ACTION_BOOT_COMPLETED ->
|
|
|
|
PollingWorker.queueBootCompleted(context)
|
|
|
|
|
|
|
|
Intent.ACTION_MY_PACKAGE_REPLACED ->
|
|
|
|
PollingWorker.queuePackageReplaced(context)
|
|
|
|
|
|
|
|
ACTION_NOTIFICATION_DELETE ->
|
|
|
|
PollingWorker.queueNotificationDeleted(context, intent.data)
|
|
|
|
|
|
|
|
else -> log.e("onReceive: unsupported action $action")
|
|
|
|
}
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|