How do I change Android screen orientation via simulating acceleration? I have developed an app and I need to test it. I have borrowed some devices from my friends and bought a few. Now problem is that I want to test it in both landscape mode and portrait mode but I don't want to  keep on changing the orientation of phones every 5 minutes manually by myself. 

Is there any adb command or anything else by which I can tell the phone to change its orientation? Can I fool it by simulating acceleration or any other alternative?

I am open to rooting but I prefer any solution which works on non-rooted phones.
I don't think you can do it via adb, but you can programmatically change the orientation using.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); 

You could link this up to a timer that would change the orientation every five minutes if that's what you want to do, or write it into unit tests to automatically check if everything goes ok when you change orientation.