Ios wake up iphone

I created an app that compare gyro data and sends an email if the user does not touch it for 2 mins. Unfortunately, its not working in the background, or in sleep mode.
Is it possible to keep running an app while the phone is in sleep mode?

Yes, but not allowed if it’s not for a valid reason like playing an audio stream f.e.