App launch .. screen off

app launch. Twice it happened that during the activity the phone screen turns off if I inadvertently press the off switch. If I notice it I turn the screen back on and reopen the app. … time passes while the kilometers always remain the same… I have to stop the app and restart the app and the kilometers return to normal… is it possible if you close the screen to send a voice message saying that the screen is closed and restart the application?? I await your news, best regards