Make use of ContextCompat methods such as startForegroundService and getSystemService.
ContextCompat
startForegroundService
getSystemService