Note: You should use magnets for good purposes. This article is purely intended for your education.
There’s a common myth that says a strong magnet can wipe a phone’s data. Is it true? Simply, no, a magnet cannot wipe your phone. You don’t have to worry about your favorite magnet or magnetic phone case factory resetting your phone (but it might still harm your phone: More information on that later in the article.)
A simple Google search will prove it: Almost all modern phones use solid state drives (SSD) to store data. This does not encode your data magnetically, which means magnets do nothing to most phone’s memory. Another myth is that magnets will affecet your screen, which is not true. Almost all modern phones use LCD, OLED or LED display, and no evidence shows that magnetic fields interfere with those.
Where did the two myths originate? Nobody knows for sure, but this is probably where they came from: Old devices and storage systems stored data magnetically. Some devices that store data magnetically include old hard disk drives and floppy disks. Magnets do affect those, and can wipe them, but you would need a magnet with at least 450 lbs (~204 kg) of force to clear an old magnetic hard drive, according to US Magnetix.
The second one probably originated because magnets can affect CRT displays, which are old and are now mostly unused because they’re inferior to modern displays, as CRT need more power, has poor image quality, and consume much more space, according to profolus.com.
That doesn’t mean magnets won’t have an effect on your phone. A magnet can temporarily mess with many of the phones’ features, like the phone’s compass, and the phone’s lens-position sensors according to this apple article, and more. Cases of magnets causing permanent damages are quite rare, but a strong magnet can magnetize metal in a phone which affects compass. There may be permanent magnetization in some cases. Magnets can demagnetize key magnets like ones in audio-related functions, but it would also have to be an extreme case, like a very strong magnet being very close to the target magnet.
All in all, your new phone’s data and screen is safe from magnets, and cases where components that are not immune are permanently altered are rare, as it will usually need a strong magnet to be close to cause permanent damage.
RELATED ARTICLES
https://www.howtogeek.com/820346/can-a-magnet-really-damage-my-phone-or-computer/
https://www.digitaltrends.com/mobile/how-magnets-really-affect-phones-hard-drives/