How To Activate Function When The Phone Being Used

Read here
I don’t think that there is an extension for this purpose. They have to implement the background services to MIT App Inventor first.