Someone created an application to detect metal using the Android G1. This isn’t because the G1 is so much more awesome than other smartphones. It’s done through clever use of the built-in compass. A compass detects the magnetic field of the Earth.
Sadly it won’t help you find treasure at the beach. Think of it more like the ones they use in airports. The kind that let you magically pass your hands over someone’s body to see if they are hiding metal somewhere. Which is great I guess. If you are security in the lowest budget airport ever.