Don't add it to the activity.
For this you will need to add it somewhere else. Create a viewgroup in the same service and add it to the windowmanager. Your surfaceview will be working independently of the activity lifecycle.
If you want to "link" its behaviour to the activity, you can use the activity events to know when to show it if activity is running (as if it was inserted in the activity), and hide it on activity pause (if this is the effect you want to achieve)
I have something similar also working with the camera when screen is off, but stopped due to lack of time
https://www.b4x.com/android/forum/threads/having-fun.62566/