Well, to understand orientation is enough simple. In Activity_Create is possible to retrieve getResources.getConfiguration, field orientation. In addition windowManager ().getDefaultDisplay ().getRotation ().
I can make a test app. But I am not sure that you need to do something by yourself. Take a look Erel's camera based intent.
If you want to do by yourself anyway, look carefully built-in Camera app. it works in Portrait (!). To detect real orientation and to change direction of icons, native camera app uses sensors. I am aware how to do this, because I did Camera activity, but this is enough complex.