Cleaning down phone between uses? I'm project manager consulting for a charity who have a set of LG Nexus phones that are sent into schools as part of a STEM project.  For safeguarding reasons when the phones are returned we need to clear off any photos, videos, audio recordings and any internet cache/history.  There are a couple of apps loaded onto the phones for the students to use that need to be retained.

I'm looking for a fast solution for cleaning the phones.  All the phones are connected to the same Gmail account.

I know nothing about coding for Android devices (or anything about Android devices in truth!) so please be kind with your responses.

Many thanks in advance.

Julia
If the data of the apps that need to be retained is not important, a fast-but-dirty solution would be to integrate those apps into the system partition. That way the phones' data will easily be erasable via a factory reset, but the apps you need will stay installed on the device. That way the only thing left to do after the reset is re-connect the phones to your Google account.

To "convert" apps into system apps, however, one would require root permissions (and possibly unlocking the bootloader), which may void the warranty of the phones based on where you live/where those phones were bought. (In the EU, for example, the warranty would remain intact.) Truth be told there are dozens of "quick but sloppy" ways to achieve this but I don't think any of them apply for your use case.

Another way I can think of that does not require root is to trust Google's cloud device backup -- Since Android 6.0 (Marshmallow), a device's apps and apps' data, WiFi connections etc. are periodically uploaded into the cloud so that, if a customer buys a new device (or resets their current one), the Setup Wizard that launches at first boot can offer to restore the data that was previously backed up. Sadly (though understandably), this only works for applications that are installed off the Play Store. The downside of this method is that a) you'll still have to connect the devices to the Play Store, and that b) the backup functionality only works periodically, so the data that ends up getting restored might be several days old. There are other ways to back up and restore data on an Android device (sadly my reputation won't allow me to post a link, but a quick online search for 'android backup tool' will do the trick) but those are, again, cumbersome and sometimes unreliable.

I've heard some good things about Google Classroom, but I don't know if it supports wiping devices, or if it fits into the scope of your project.