The Smart connect app is responsible for the device's behaviour when a pair of headphones is connected to it. If your device misbehaves when you connect headphones to it, try clearing the data of the Smart connect app through Settings.
To clear the data:
Maybe a minor software conflict is the reason for your device not being able to recognize headphones. Try uchecking and checking the Clear audio option.
To do that, follow the steps below:
If you don’t receive the email in the next 2 minutes please check your junk folder, and add [email protected] to your safe sender list.