Newer
Older
MonCalc / app / src / main / kotlin / jackall / moncalc / service / MainService.kt
package jackall.moncalc.service

import android.app.Service
import android.content.Intent
import android.os.IBinder
import android.support.v4.app.NotificationCompat
import jackall.moncalc.Const
import jackall.moncalc.R

/**
 * Created by matsumoto_k on 2017/11/01.
 */
class MainService : Service() {

    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        val notificationBuilder = NotificationCompat.Builder(this, Const.serviceChannelId)
                .setContentTitle("mainService") // TODO:タイトルをセット
                .setSmallIcon(R.mipmap.ic_launcher) // TODO:白抜きのアイコンをセット
        startForeground(Const.notificationId, notificationBuilder.build())

        return START_STICKY
    }

    override fun onBind(intent: Intent?): IBinder? {
        return null
    }
}