Yes you are on right path but if you are running in real device then make sure that default android recording app is installed and running, try first with emulator or in some other device if you have and then check.
Your code is perfect only i did not see any error in this.