package jackall.overlaymulticounter.service import android.app.PendingIntent import android.app.Service import android.content.Intent import android.os.IBinder import android.support.v4.app.NotificationCompat import jackall.overlaymulticounter.Const import jackall.overlaymulticounter.R import jackall.overlaymulticounter.activity.MainActivity /** * Created by matsumoto_k on 2017/11/08. */ class MainService : Service() { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { val notificationBuilder = NotificationCompat.Builder(this, Const.serviceChannelId) .setSmallIcon(R.mipmap.ic_launcher) // TODO:白抜きのアイコンをセット notificationBuilder.setContentIntent(PendingIntent.getActivity(this, 0, Intent(this, MainActivity::class.java), PendingIntent.FLAG_UPDATE_CURRENT)) startForeground(Const.serviceNotificationId, notificationBuilder.build()) return START_STICKY } override fun onBind(intent: Intent?): IBinder? { return null } }