How could you detect a microphone attached to a smartphone?
The the problem is probably the standard 3.5mm jack. Smart phones use four pole 3.5mm jacks to add a mic to a headset.
There are two configurations used but the most common (read what Apple pushes) is to have the sleeve as mic in, ground on the adjacent ring, right audio on the next ring then left on the tip.

Pinout with list of phones

I know that most recent Samsung phones reverse ground and mic in. I actually built a small crossover cable to get around this issue.

According to  this page the mic should work if the resistance is about 2.2k ohms.

I only assume this works based on the success of using my crossover cable to use a headset/mic with button designed for iPhone on my Galaxy S.