You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
csamsclient/lib/src/main/java/com/gyf/lib/service/BaseActivity.kt

26 lines
666 B

package com.gyf.lib.service
import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import com.gyf.lib.util.ClientType
abstract class BaseActivity : ComponentActivity() {
abstract val clientType: ClientType
private val serviceIntent
get() = Intent(this, MessageService::class.java).apply {
putExtra(ClientType::class.java.name, clientType)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
startService(serviceIntent)
}
override fun onResume() {
super.onResume()
startService(serviceIntent)
}
}