If you have sold, or are planning to sell, an old Android phone, you may want to reconsider the deal if you can.

That's because a new study by computer researchers at the University of Cambridge have found that a factory reset on the devices doesn't erase anything, CNN Money has reported.

In the study, the researchers tested 21 phones from Google, HTC, LG, Motorola and Samsung and were able to pull text messages, Google account credentials and even emails.

>> Read more trending stories  

Digging deeper, they were able to get access to Facebook and other social media.

Photos and videos also still appeared, CNN Money reported.

So what should you do when it's time to upgrade?

There are different suggestions.

Google, according to CNN Money, suggests a multi-step process of remotely wiping the phone, hitting factory reset and updating the operating system to allow for encryption with a passcode.

You can also revoke the device's permission to access a Google account.

One cyber security expert gave another, foolproof option.  Per Thorsheim told CNN Money, "Don't hand off your old phone. Smash it."