Is it possible to get the information of automatic detection (when ear/head-phones are put/removed)?
If so, how can it be done?
Observe the notification AVAudioSession.routeChangeNotification
. For full details (including how to properly respond to this notification), see Responding to Audio Session Route Changes.