Moto G 2nd Gen phone is not working properly with android lollipop. Sometime the charger is not connected but it is showing the phone is charging. Even if I use headphone the music comes out from the loudspeaker.
Sometime the charger is not connected but it is showing the phone is charging.
A restart would fix this problem. I had this problem just after updating to LP and I never got after a restart. It's probably a small bug.
If I use head phone also the music comes out from the loudspeaker.
You need to change your headphones. Bad earphones are the cause of this issue. I had a cheap quality headset then I faced the same problem and upgraded to a quality headphone like sennheiser or skullcandy. Even the headphones which comes in the package is not so good. I personally use mi headphones which I found better than skullcandy in terms of sound and quality.