Ok, I know what is happening.
If there is some sound playing (like background music) the volume buttons will control the media volume, but when no sound is playing the buttons will control the ringer volume.
If there isnt background music, the buttons only will work if there is some effect sound playing, so it will be strange.
I prefer the buttons always change the media volume. It can be done adding this line to the method onCreate of the main activity :