It’s not a foolproof plan, but if you have risky apps on your device, then a factory reset removing said programs may help to eradicate the problem.