问题描述
package com.example.slidablemenu
import android.app.IntentService
import android.content.Intent
import android.util.Log
class MyIntentService : IntentService("MyIntentService") {
init {
instance = this
}
companion object {
private lateinit var instance: MyIntentService
var isRunning = false;
fun stopService() {
Log.d("MyIntentService"," Service is stopping...")
isRunning = false
instance.stopSelf()
}
}
override fun onHandleIntent(intent: Intent?) {
try {
isRunning = true
while (isRunning) {
Log.d("MyIntentService"," Service is running...")
Thread.sleep(1000)
}
} catch (e: InterruptedException) {
Thread.currentThread().interrupt()
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)