3.5mm headphone as button or switch

If the headphone cable is plugged into the phone I don't understand how it could carry an on/off signal?

Can you explain the project you are trying to implement?

...R