Identify if the mobile device is being used, locked/unlocked

How are you?

I would like to know if there is a way to identify when the mobile is locked or is not being used.

I need to launch a message after the phone (not my app) has not been used for 10 minutes. My app will be running in the background and monitoring if the mobile is being used or not.

I looked at resume, but it only tells me is my app is in the background.

Has someone facing this issue and found the solution?

I really appreciate your input

Hey, i am searching for the Same thing
You got an solution yet?

Hihow are you?Not yet, I was out of my project for awhile but so far no luck.
I will continue making more research