When I connect charger to my xperia m it does not charge but when I switched it off it starts charging?
Hello, what makes you say that it doesn't charge while it is on? Do a little bit of troubleshooting to make sure everything is working as it should.
Check the battery icon near the top right corner of the screen as soon as you connect the charger cable and see if there is a lightning icon inside it. If it does, then that means that it is charging. If you are able to charge the Sony Xperia M while it is off with the use of a wall charger, then there should be no reason for it to not charge while it is on.
Hope this helped to clear a few things up for you. And if you still have some questions, just post them in reply to us here.