You can prevent someone from spying on your mobile, whether that's by installing a spy app or using another method. These include being careful of what apps you install on the target device, using a VPN at all times, and keeping the software of the target phone up to date.