Galaxy Nexus does not charge when powered on, but it charges properly when powered off. Phone doesn't detect USB connection also. This happened without any reason. Phone is not rooted.
Tried different cable, charger, everything.
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It only takes a minute to sign up.Sign up to join this community
That sounds to me like a hardware issue. If you're still under warranty, I'd get it repaired. If not, you'll have to decide whether you want to live with it or pay for repair (or replace the phone).
Do you happen to be using a 3rd party charger?
500mAh chargers cannot charge the Nexus while on, 1Ah chargers can but might struggle. I recommend chargers with 1.5Ah for charging high-end devices
Alternatively, the problem might lie with the power management of your ROM. Have you also installed an app recently before this happened?