Consider - an app that replicates this functionality on the phone, but tracks if the user at any point closes the app. This then is reported to the teacher so the teacher knows if there was any cheating.
Bring your own device sounds like a mess. Someone would create an app that looks like the locked down app but isn't really, etc. Or students would sneak in a second phone.
You really don't want to give teenagers the temptation to sneak online or into their notes during exams.