How to make sure none of your information remains on your smartphone after you've sold it. Reuters

Thinking of trading in your old smartphone for cash? Great idea. One problem: your entire life is on that phone, including emails, photos, passwords, social accounts and the data stored in mobile apps. Services like Gazelle, NextWorth, Glyde and Amazon advise performing a factory reset before mailing the old phone in, but that won't necessarily scrub sensitive data that may be hidden deep within a device.

Countless documents can still be uncovered from a seemingly wiped smartphone, including images, videos, bank information from apps, text messages, emails, Web browsing history and location history. Security company Avast demonstrated this in July when it lifted more than 40,000 photos and other data from secondhand Android devices listed on eBay.com (NASDAQ:EBAY).

Even when a smartphone is wiped, data can be stored on secondary memory sources within the device, which can then be accessed by other parties once the device is no longer in the owner’s possession. Due to the open source nature of Android devices, they often lack the native security features to thoroughly wipe a device and delete all information.

Apple (NASDAQ:AAPL) devices tend to not have this problem because of the hardware encryption already implemented onto iPhone models, which allows information to be stored on handsets confidentially. Wiping an Apple device is as easy as accessing Settings > General > Reset > Erase All Content and Settings.

Wiping an Android device more thoroughly takes a few more steps, but it can be done. Here’s how:

Encrypt phone before wiping. Encrypting your Android smartphone before wiping it will make information on the device confidential, so even if data was left on the phone it would be inaccessible without painstaking effort. Keep in mind that encrypting and wiping a device are two different actions. To encrypt an Android device, a user must first set a lock screen PIN, which can be done in settings. Then the user must access Settings > Security > Encrypt device to begin the encryption process, which takes about 30 minutes. Once started, the user doesn't have to do anything but wait for the process to complete. The user must remember the PIN created for the device or else they won’t be able to access the encrypted smartphone.

Once encrypted, the user can proceed to wipe the device. Keep in mind that wiping the device will reset the encryption; however, latent data should remain inaccessible. To wipe an Android device, a user must access Settings > Personal/Accounts > Backup and reset > Factory data reset. The gateway to the factory reset option may be different depending on the brand of the device. Once started, the user does not have to do anything but wait for the process to complete.

Use third-party complete wipe applications. There are several applications that claim to do a more thorough wipe of smartphones than the standard factory reset. Well-known apps include Cerberus, Lookout and Avast's antitheft app. Users can also search the Google Play Store for other tools, both free and paid.

Wipe again for safe measure. A single factory reset may leave latent data on a device, but a second one may give users a little more security that all of their data has been erased. Using a double-wiping method entails factory resetting a smartphone once, adding some insignificant data to the device, a silly photo or video for example, and then wiping the device again. The new data should overwrite any old data that may be hidden in a device's secondary memory, while the second wipe gets rid of the data that was added. However, this method also may not assure a 100 percent wipe of a smartphone.

Other things to consider. When preparing your smartphone for resale, be sure to back up any information do you want to save. Both Apple and Google Inc. (NASDAQ:GOOGL) have cloud services that allow users to store data for safekeeping that they can access from any device. Users should also be sure to remove any external cards, such as SIM cards and SD cards. A user will need their SIM card if they want to keep their current phone number. SD memory cards can store sensitive important information just like a device’s internal memory. But users can also reuse their SD cards on their new smartphone, if it’s compatible.