No, you can’t use your phone for treasure hunting. However, if you’ve lost a piece of jewelry or want to find a needle that rolled off your hand, you can use your smartphone as a metal detector.
You’ll find a ton of metal detector apps on the Google Play Store and App Store. The apps are free, though not ad-free. Download one of those to your Android or iOS device and start your metal search by moving your phone around.
The app will use a built-in magnetometer to find metallic objects as you move your device, and notify you when it finds a metal object.
Note that there might also be other metallic objects in the area and electronic items like TV and refrigerator. These objects may get in the way when you’re using a metal detecting app. The results are usually not completely reliable and depend on your phone’s magnetic sensor, but they’re helpful nonetheless.