Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / watch-wear / src / main / java / com / vayunmathur / watch / wear / platform / BootReceiver.kt
BootReceiver.kt17 lines · 570 BRaw
| 1 | package com.vayunmathur.watch.wear.platform |
| 2 | |
| 3 | import android.content.BroadcastReceiver |
| 4 | import android.content.Context |
| 5 | import android.content.Intent |
| 6 | import com.vayunmathur.watch.wear.service.ConduitService |
| 7 | |
| 8 | /** Starts the conduit foreground service after boot or app replacement. */ |
| 9 | class BootReceiver : BroadcastReceiver() { |
| 10 | override fun onReceive(context: Context, intent: Intent) { |
| 11 | when (intent.action) { |
| 12 | Intent.ACTION_BOOT_COMPLETED, |
| 13 | Intent.ACTION_MY_PACKAGE_REPLACED, |
| 14 | -> ConduitService.start(context) |
| 15 | } |
| 16 | } |
| 17 | } |