Keep phone from locking

So y’all know how when google maps is running and when you press the lock screen on your phone to turn the screen off and press it again to turn it back on, the lock screen doesn’t show up and it opens directly in the application.

Any ideas of how to do this with Ionic/Cordova? Or does anyone know how google does it?