how can I prevent a factory reset of Samsung android device?
This happened after any android user hard reset its device. There is a security feature in every android device apart from "Kitkat Patch and Lower" which is FRP (Factory Reset Protection) that helps user data to be secured after a hard reset is performed. Now you may provide the right Google account details, if not then you need to break this FRP lock using an android application. Don't forget to follow the steps to recover your device completely.