삽질
삽질 - Android ForegroundService
강태종
2020. 11. 29. 16:10
권한설정
Oreo이상에서 ForegroundService는 권한이 필요하다.
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
startForeground
startForeground에서 id값은 0이면 안된다.
오류
startForeground(0, NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID).build())
해결
startForeground(1, NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID).build())