| 1 | <service android:name=".HelloService" /> |
HelloService.kt
· 312 B · Kotlin
Raw
class HelloService : Service() {
override fun onBind(p0: Intent?): IBinder? {
return null
}
/*
START_NOT_STICKY
START_STICKY
START_REDELIVER_INTENT
*/
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
return START_STICKY
}
}
| 1 | class HelloService : Service() { |
| 2 | override fun onBind(p0: Intent?): IBinder? { |
| 3 | return null |
| 4 | } |
| 5 | |
| 6 | /* |
| 7 | START_NOT_STICKY |
| 8 | START_STICKY |
| 9 | START_REDELIVER_INTENT |
| 10 | */ |
| 11 | override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { |
| 12 | return START_STICKY |
| 13 | } |
| 14 | |
| 15 | } |
gistfile1.txt
· 73 B · Text
Raw
val intent = Intent(this, HelloService::class.java)
startService(intent)
| 1 | val intent = Intent(this, HelloService::class.java) |
| 2 | startService(intent) |
| 3 |