Foreground service

I’m creating GPS tracking service. So I need the app works without sleeping.

I readed this: Foreground services  |  Android Developers

I added this to the AndroidManifest.xml:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

But i’ve got a problem with example code:
startForeground(): Unresolved reference: startForeground. But stopForeground works.

I don’t know what I must to do.

Solution: startForegroundService(requireContext(),...