There is a lot of changes in Oreo.
It's impossible to say something without short sample, which demonstrates how exactly you start an activity.
If you really have 8.1 (API 27) due to updates, you need to add
SetActivityAttribute (main, android:showWhenLocked, "true")
SetActivityAttribute (main, android:turnScreenOn, "true")
to manifest or to call corresponding functions
I combined your code with
https://www.b4x.com/android/forum/t...d-how-to-wake-up-this-app-from-service.96792/
After pressing Power button (which locks screen), the app sleeps 15 seconds and appears again.
The code assumes API 27+. Works normally on my phone (Android 8.1.0).